We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

URL rewrite with IIS and FastCGIRSS

2 replies

Last post Aug 13, 2020 08:41 AM by TheRaspyDev

  • URL rewrite with IIS and FastCGI

    Nov 11, 2016 09:37 AM|sothrieg|LINK

    We want to address a Python application (MapProxy) in an IIS 8.5 using FastCGI. On the Python page, wfastcgi.py is used.
    This scenario works in principle, even with its own "MapProxy" site in IIS.

    Our problem is that in this constellation we can no longer use URL rewrite to mask the calls to the MapProxy site. This is set on the "Default Web Site" and works with us only with "Redirect". "Rewrite" results in 404, although the URL pattern is correctly recognized and set.

  • Re: URL rewrite with IIS and FastCGI

    Nov 14, 2016 01:56 AM|Yuk Ding|LINK

    Hi sothrieg,

    Could you provide your rewrite rule?

    If you create a rule with rewrite map, will it work fine?

    This link provide the method to create a rewrite map:


    Besides, I think you could try to enable the failed request tracing which could provide the detail and information about the error and warning. Please post the log here and I could help you find the reason:


    Best Regards,

    Yuk Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: URL rewrite with IIS and FastCGI

    Aug 13, 2020 08:41 AM|TheRaspyDev|LINK

    Hi Yuk Ding

    Sorry for hijacking an old thread. I have exactly the same problem as sothrieg posted.
    You tried to help him but didn't get an answer.

    So maybe you can help me instead ;).

    This is my rewrite rule (in applicationHost.config):

    <rule name="MapProxyRule" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
        <match url="mapproxy*" />
        <action type="Rewrite" url="https://localhost:5443/{R:1}" />

    I setup Failed Request Tracing but I just see the 404 error without any additional information:

    The problem arises when calling the URL https://myservername/mapproxy from an "external" machine. IIS shoud rewrite the URL to the internal URL https://localhost:5443 but returns a 404 error.

    Calling the URL https://localhost:5443 locally (on the webserver) works as expected.

    I think the problem is related to the fastcgi environment (path, environment variables, ...) being somehow different when doing a rewrite.

    I didn't try the rewrite map yet because I think the problem is related to rewrite and fastcgi.
    Btw: What's the difference between a rewrite rule and a rewrite map?

    Any help would be greatly appreciated.