title: How to support both HTTP and HTTPS channels in Flex/BlazeDS?
body: <p>I've been trying to find the right configuration for supporting both http/s requests in a Flex app. I've read all the docs and they allude to doing something like the following:</p>
  
  <pre><code>&lt;default-channels&gt;
    &lt;channel ref="my-secure-amf"&gt;
      &lt;serialization&gt;
        &lt;log-property-errors&gt;true&lt;/log-property-errors&gt;
      &lt;/serialization&gt;
    &lt;/channel&gt;
    &lt;channel ref="my-amf"&gt;
      &lt;serialization&gt;
        &lt;log-property-errors&gt;true&lt;/log-property-errors&gt;
      &lt;/serialization&gt;
    &lt;/channel&gt;
  </code></pre>
  
  <p></p>
  
  <p>This works great when hitting the app via https but get intermittent communication failures when hitting the same app via http. Here's an abbreviated services-config.xml:</p>
  
  <pre><code>&lt;channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"&gt;
        &lt;endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
                  class="flex.messaging.endpoints.AMFEndpoint"/&gt;
        &lt;properties&gt;
          &lt;!-- 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 --&gt;
          &lt;add-no-cache-headers&gt;false&lt;/add-no-cache-headers&gt;
          &lt;!-- Use to limit the client channel's connect attempt to the specified time interval. --&gt;
          &lt;connect-timeout-seconds&gt;10&lt;/connect-timeout-seconds&gt;
        &lt;/properties&gt;
      &lt;/channel-definition&gt;
  
      &lt;channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"&gt;
        &lt;!--&lt;endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/&gt;--&gt;
        &lt;endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure"
                  class="flex.messaging.endpoints.AMFEndpoint"/&gt;
        &lt;properties&gt;
          &lt;add-no-cache-headers&gt;false&lt;/add-no-cache-headers&gt;
          &lt;connect-timeout-seconds&gt;10&lt;/connect-timeout-seconds&gt;
        &lt;/properties&gt;
      &lt;/channel-definition&gt;
  </code></pre>
  
  <p>I'm running with Tomcat 5.5.17 and Java 5.</p>
  
  <ol>
  <li>The BlazeDS docs say this is the best practice. Is there a better way?</li>
  <li>With this config, there seems to be 2-3 retries associated with each channel defined in the default-channels element so it always takes ~20s before the my-amf channel connects via a http request. Is there a way to override the 2-3 retries to say, 1 retry for each channel?</li>
  </ol>
  
  <p>Thanks in advance for answers. </p>