4 Replies Latest reply on Jul 21, 2010 2:34 AM by dtcullen

    Secure PHP Data Services

    dtcullen Level 1

      I have just migrated to using a secure site and have modified my .htaccess file in Apache on my hosting service to force http://www.mydomain.com to https://mydomain.com.  I need this since all works well when I log in as https://mydomain.com. The problem arise when I call my php data services, I get the following error;

       

      Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://www.mydomain.com/gateway.php'

       

      which I presume is because this is being called via 'http' and not 'https'.  I cannot find anywhere that I can change this.  I see lots of references in the forums to services-config.xml but cannot find that - it seems to be more related to LCDS anyway.  Any clues would be welcome.

       

       

      Regards and Thanks

       

       

      Des Cullen.

        • 1. Re: Secure PHP Data Services
          Scott S_DW Level 1

          Hi Des,

           

          we had a similar problem recently with AMFPHP.

           

          We changed our service-config file to use the SecureAMFChannel, SecureAMFEndpoint and added a property to not cache the headers - this worked for us.

           

           

           

           

          <channels>
                  <channel-definition id="my-amfphp" class="mx.messaging.channels.SecureAMFChannel">
                      <endpoint url="https://mydomain.com/amfphp/gateway.php"
                      class="flex.messaging.endpoints.SecureAMFEndpoint"/>
                      <properties>
                             <add-no-cache-headers>false</add-no-cache-headers>
                         </properties>
                  </channel-definition>
              </channels>

           

           

          Hope this points you in the right direction.

           

          Scott

          • 2. Re: Secure PHP Data Services
            dtcullen Level 1

            Hi Scott,

               

                Thanks a lot for the reply.  Nice to know I'm at least going in the right direction but having spent a few more hours at it I have a number of questions on this services-config thing;

             

            1.  Does it need to be deployed or is the contents being compiled into the swf.  I have added the additional arguments into the compiler and it is obviously

            ignoring the contents of the file.  I have tried deploying it as well.

            2.  Does the ID of the service (as defined in the services-config.xml) have any impact if so what should it be called.

            3.  If you have a config-services on your development machine which points to what you will be using when it is live surely it should fail - but it does'nt.

            4.  Is this documented anywhere by Adobe - NOT LCDS - I am using php data services.

             

             

            Regards

             

             

            Des.

             

             

            Hi Des,

             

            we had a similar problem recently with AMFPHP.

             

            We changed our service-config file to use the SecureAMFChannel, SecureAMFEndpoint and added a property to not cache the headers - this worked for us.

             

             

             

             

            <channels>

                    <channel-definition id="my-amfphp" class="mx.messaging.channels.SecureAMFChannel">

                        <endpoint url="https://mydomain.com/amfphp/gateway.php"

                        class="flex.messaging.endpoints.SecureAMFEndpoint"/>

                        <properties>

                               <add-no-cache-headers>false</add-no-cache-headers>

                           </properties>

                    </channel-definition>

                </channels>

             

             

            Hope this points you in the right direction.

             

            Scott

            >

            • 3. Re: Secure PHP Data Services
              Scott S_DW Level 1

              Hi Des,

               

              I am not an expert on this so my answers may not be correct -

              1.     The service-config is compiled.  We found that every time we changed the service-config file the changes would not be picked up unless we cleared the browsers cache and cleaned the project (through the project menu - then clean)

              2.     I don't think the id is relevant unless you intend to change or set properties at run time.

              3.     No idea - I would think the opposite - I would not expect it to fail - but I also don't quite get what you mean?????

              4.     Not that I have seen.

               

              Lastly, have you got a crossdomain.xml file on the server???

               

              Sorry I could not be of anymore help.

               

              Cheers

              Scott

              • 4. Re: Secure PHP Data Services
                dtcullen Level 1

                Scott.  Thanks a lot.  You have been a great help.  I have found a solution but not quite as elegant as I would like;

                 

                Essentially I have not been able to get the services-config.xml to work so I have resorted to changing the 'endpoint' of my services at runtime by using;

                 

                myService.endpoint="https://www.mydomain.com/gateway.php";

                 

                The data services that I use are auto generated by Flash Builder from MYySQL tables (with some further mods) and create classes in the 'services' package of my project where the endpoint is defined in a SupermyService.as class.  I have been able to get this working by changing these classes to define the endpoint as starting with "https://...".  Obviously that is not ideal since this will be wiped out if I ever refresh the service which is why I have adopted the runtime definition tack.

                 

                I think I am missing something about how the services-config.mxl 'connects' with the generated classes.  I have put some code into my app to examine the

                config at runtime;

                 

                var chan:Channel = ServerConfig.getChannel("zend-endpoint");

                var prop:XMLList = ServerConfig.getProperties("ZendAmf");

                 

                .. and it is there okay but has no effect on my service classes.

                 

                In answer to your question ... no I don't have a crossdomain.xml file on the server.  I figure I don't need it since the website does not need to grab data from

                any other domain.

                 

                Regards and thanks for your help.

                 

                Des.

                 

                 

                Hi Des,

                 

                I am not an expert on this so my answers may not be correct -

                1.     The service-config is compiled.  We found that every time we changed the service-config file the changes would not be picked up unless we cleared the browsers cache and cleaned the project (through the project menu - then clean)

                2.     I don't think the id is relevant unless you intend to change or set properties at run time.

                3.     No idea - I would think the opposite - I would not expect it to fail - but I also don't quite get what you mean?????

                4.     Not that I have seen.

                 

                Lastly, have you got a crossdomain.xml file on the server???

                 

                Sorry I could not be of anymore help.

                 

                Cheers

                Scott

                >