'If there is an IIS between the website and the server, 301 redirected requests lose the query string

There is a website and a server. If the website access the server directly, everything works. The website asks for .../jobs?limit=50.

It gets a 301 and is redirected to .../jobs/?limit=50 And Success!

Now we add a IIS in between the two. The IIS does URL rewrite. The website asks for .../jobs?limit=50. Gets again a 301 BUT it is now redirected to .../jobs/ only.

The querystring is lost. It is missing at the "location" parameter in the response header of the 301 response.

The rewrite rule is set up with the pattern ^(abc.*) and rewrite URL is http://localhost:1234/{R:1}. Append query string is checked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source