I have a problem as stated in the header. Some backgroun information.
There’s a URL like this https://external_server.something.xy/SomeService/Something which is exposed to the outside world through reverse proxy.
- The reverse proxy peels off the HTTPS and forwards the traffic to the
WCF service as plain HTTP and applies HTTPS to the response. - The binding is basicHttpBinding (with
<transport clientCredentialType="Basic" proxyCredentialType="None" realm="" />).
For this and some contractual reasons a static WSDL file (Something.wsdl) is distributed to clients. Alas, still there’s a lot of code out there that retrieves the WSDL without the distributed static WSDL file and then generating the calls dynamically (for whatever reason).
If I set in the configuration file like <serviceMetadata httpGetEnabled="true" externalMetadataLocation="../Something.wsdl"/> the customer will be welcomed with a HTTP 307 Temporary Redirect.
In any event, with some research I have found that setting IIS host headers would, I believe, affect many other applications too on the same IIS. This is a no-go solution. Is there something I can configure in the web.config or should I investigate URL Rewriting schemes either on the server or on the reverse proxy?
As an added bonus would be, if I could set the URL shown on the help page so it doesn’t show the internal server (so that the link would work, too!).
To answer my own question I (or we) re-wrote the request on reverse proxy, so it’s transparent for the clients and for the internal server. Now it intercepts metadata queries to this service and points them to the static WCF file (through the URI which shows in the help page), which is then just returned.
The problem was that when I used the externalMetadaLocation tag, IIS returned HTTP 307, which the reverse proxy then relayed to the client. Of course the internal server didn’t know about the external address, so the redirect was with the internal name and hence the problems.
The other option I was thinking was to write a REST function that would match the Something?wsdl part of the web service, thus it wouldn’t have reached the WCF metadata facilities. After contemplating that for a whle, I became to think about using IWsdlExceportExtension to do the job of receiving the request and then just grabbing the file and returning it (that is, without redirect).