How to support both HTTP and HTTPS channels in Flex / BlazeDS?

I am trying to find the right configuration to support both http / s requests in a Flex application. I have read all the docs and they reference the following:

<default-channels> <channel ref="my-secure-amf"> <serialization> <log-property-errors>true</log-property-errors> </serialization> </channel> <channel ref="my-amf"> <serialization> <log-property-errors>true</log-property-errors> </serialization> </channel> 

This works great when entering the application via https, but it causes intermittent communication failures when you get to the same application via http. Here's the abbreviated services-config.xml:

 <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> <properties> <!-- HTTPS requests don't work on IE when pragma "no-cache" headers are set so you need to set the add-no-cache-headers property to false --> <add-no-cache-headers>false</add-no-cache-headers> <!-- Use to limit the client channel connect attempt to the specified time interval. --> <connect-timeout-seconds>10</connect-timeout-seconds> </properties> </channel-definition> <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> <!--<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>--> <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.AMFEndpoint"/> <properties> <add-no-cache-headers>false</add-no-cache-headers> <connect-timeout-seconds>10</connect-timeout-seconds> </properties> </channel-definition> 

I work with Tomcat 5.5.17 and Java 5.

  • BlazeDS docs say this is best practice. Is there a better way?
  • With this configuration, there are apparently 2-3 repetitions associated with each channel defined in the default-channels element, so it always takes ~ 20 s before the my-amf channel is connected via an HTTP request. Is there a way to undo 2-3 repetitions to say: 1 repeat for each channel?

Thanks in advance for your answers.

+4
source share
3 answers

I have http and https working, although I only tested Firefox and IE7. So far I am using BlazeDS for remote access. Here is my setup:

  <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint" /> <properties> <polling-enabled>false</polling-enabled> </properties> </channel-definition> <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint" /> <properties> <add-no-cache-headers>false</add-no-cache-headers> </properties> </channel-definition> 

You do not specify the application server that you are using; this can be a problem. I'm having trouble switching from HTTPS to HTTP (secure logins) under Tomcat. One thing I did to troubleshoot is to install Jetty and try it there. I have never used it before, but it was very quick to configure and deploy, even through Eclipse. Then I knew that I had a specific Tomcat problem that made it easier to find a solution (which I mean).

+3
source

This also turned us on. To solve this problem, first make http (my-amf) in the default tag and then https (my-secure-amf)

 <default-channels> <channel ref="my-amf"> <serialization> <log-property-errors>true</log-property-errors> </serialization> </channel> <channel ref="my-secure-amf"> <serialization> <log-property-errors>true</log-property-errors> </serialization> </channel> 
+1
source

If the destinations using http and https are different destinations, you can define channels for the purpose of using the destination for this. For example, mySecureDestination and myDestination are two different destinations. For mySecureDestination:

 <destination id="mySecureDestination" channels="httpsChannel"></destination> 

and for an insecure http channel

 <destination id="myDestination" channels="httpChannel"></destination> 
0
source

Source: https://habr.com/ru/post/1286383/


All Articles