Having trouble with file downloads, using IIS and reverse proxy

I’ve searched around but haven’t found a solution that works.

The headers that are sent through the reverse proxy look like this (tested with a separate web server):

For clarity, the IIS configuration looks like this:

The response from /xmds.php?v=5&method=requiredFiles looks like this:

The rewrite url is http://medxibo01/{R:1}.

As you can see the path is incorrect. It’s linking to the proxy url. Anyone have a clue why?

  • I’m using the docker version (1.8.11).
  • The linux server uses Ubuntu Server 18.04.1 LTS.
  • The reverse proxy server runs on Windows Server 2008 R2, IIS version 7.5.7600.


Looking at the source code for generating a link to the download, it seems i need to set the value of CDN_URL in the settings?

I can’t find anything in the settings or documentation mentioning this though.

Edit 2:

Actually looking closer, it’s this code that generates the url if you’re not a CDN.

I’m not sure if it’s even looking at any headers though to modify the url.

You must pass the Host header through to the backend as Host from the reverse proxy.

I’m not sure what you mean, isn’t that what i’ve done? Or do you mean pass it literally as Host?

It must be passed in as Host. You’re passing in X_FORWARDED_HOST which won’t be recognised.

Ah alright, thanks! It works now.

For future readers using IIS:

You need to enable preserveHostHeader in your IIS config. (After that you won’t need to set the host header manually in the rewrite rule.)

Simplest way is to execute this command:
"C:\Windows\System32\inetsrv\appcmd.exe" set config -section:system.webServer/proxy /preserveHostHeader:"True" /commit:apphost
Source: https://stackoverflow.com/questions/1842885/modifying-headers-with-iis7-application-request-routing

Setting it in the website’s web.config didn’t seem to work for me, but the command above worked fine.

1 Like