Home > Software design >  If there is an IIS between the website and the server, 301 redirected requests lose the query string
If there is an IIS between the website and the server, 301 redirected requests lose the query string

Time:05-25

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.

CodePudding user response:

You need to see if the web.config file contains the statement appendQueryString="true"

One possibility is that if the "Append Query String" checkbox is enabled by default, the web.config file may not contain the statement. You can try unchecking it first and then rechecking it again.

If still unsuccessful, you can read this official article from Microsoft. And try to reinstall the latest version of URL Rewrite Module.

  • Related