Configuring WCF behind a load balancer and SSL
<p>Variations of this question have been asked all over SO, and through those questions I have been able to get my configuration 90% of the way, but I am still having some problems.  My setup looks like this:</p>

<pre><code>                                (http://server1)
                                 ----------------
                            --&gt;  -- webserver1 --
                           /     ----------------
                          /
 (https://externaldomain)/
 ---------------------- /
 --- load balancer ---- 
 ---------------------- \
                         \
                          \
                           \     (http://server2)
                            --&gt;  ----------------
                                 -- webserver2 --
                                 ----------------
</code></pre>

<p>I have specified </p>

<pre><code> &lt;useRequestHeadersForMetadataAddress&gt;
    &lt;defaultPorts&gt;
      &lt;add scheme="https" port="443" /&gt;
    &lt;/defaultPorts&gt;
  &lt;/useRequestHeadersForMetadataAddress&gt;
</code></pre>

<p>and I have set <code>httpGetEnabled</code> to false and <code>httpsGetEnabled</code> to true.  The result is that when I navigate to <code>https://externaldomain</code> I see the default service screen and it displays the correct URLs e.g. svcutil <code>https://externaldomain/svc.cs?wsdl</code></p>

<p>I have two problems:</p>

<ol>
<li>If I try to navigate to <code>https://externaldomain/svc.cs?wsdl</code> the WSDL is not shown, instead I get redirected back to the default service screen.  I am still able to add a reference to this service in Visual Studio via: <code>https://externaldomain/svc.cs/mex</code>, but I would like the WSDL to be available as well. </li>
<li>When I add the service reference to Visual Studio, the binding that gets added to the config is setup as an httpTransport and the endpoint points at http and not https.  If I manually change this to an https transport and change the URL to https for the endpoint everything works fine.  This isn't ideal.</li>
</ol>

<p>Can someone point me in the direction of some documentation on what I need to change to resolve these two problems?  The config for my Service is below.</p>

<pre><code>&lt;system.serviceModel&gt;
    &lt;client&gt;
      &lt;endpoint address="http://internalService" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMessageProcessing" contract="IMessageProcessing" name="BasicHttpBinding_IMessageProcessing" /&gt;
    &lt;/client&gt;
    &lt;services&gt;
      &lt;service behaviorConfiguration="ProcessBehavior" name="Service"&gt;
        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress="https://externaldomain/Service.svc" /&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
        &lt;endpoint binding="customBinding" bindingConfiguration="CompressionBinding" name="CompressionBindingEndpoint" contract="IService" /&gt;
        &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
      &lt;/service&gt;
    &lt;/services&gt;
    &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name="ProcessBehavior"&gt;
          &lt;serviceThrottling maxConcurrentCalls="100" /&gt;
          &lt;serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" /&gt;
&lt;useRequestHeadersForMetadataAddress&gt;
        &lt;defaultPorts&gt;
          &lt;add scheme="https" port="443" /&gt;
        &lt;/defaultPorts&gt;
      &lt;/useRequestHeadersForMetadataAddress&gt;
          &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
          &lt;!--&lt;serviceThrottling maxConcurrentCalls="200"/&gt;--&gt;
        &lt;/behavior&gt;
        &lt;behavior name="metadataSupport"&gt;
          &lt;serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" /&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;
    &lt;bindings&gt;
      &lt;basicHttpBinding&gt;
        &lt;binding name="BasicHttpBinding_IMessageProcessing" /&gt;
      &lt;/basicHttpBinding&gt;
      &lt;customBinding&gt;
        &lt;binding name="CompressionBinding" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:15:00" sendTimeout="01:30:00"&gt;
          &lt;binaryMessageEncoding compressionFormat="GZip" /&gt;
          &lt;httpTransport maxReceivedMessageSize="2147483600" decompressionEnabled="true" /&gt;
        &lt;/binding&gt;
      &lt;/customBinding&gt;
    &lt;/bindings&gt;
  &lt;/system.serviceModel&gt;
</code></pre>

<p>---------EDIT-----------</p>

<p>The issue with the endpoint downloading with an HTTP transport was kind of a 'duh' on my part.  In the binding for the endpoint I specify:</p>

<pre><code>&lt;httpTransport maxReceivedMessageSize="2147483600" decompressionEnabled="true" /&gt;
</code></pre>

<p>Changing this to <code>httpsTransport</code> adds the service reference with an https transport, but the client application is then unable to reach the endpoint.  Since the load balancer is communicating via http the transport has to remain http.  I could specific a second endpoint with an https binding but that is messy.</p>

<p>I still haven't figured out the wsdl issue though.</p>