locked
URL rewrite with IIS and FastCGI RRS feed

  • Question

  • User2119457002 posted

    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.

    Friday, November 11, 2016 9:37 AM

All replies

  • User-460007017 posted

    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:

    https://www.iis.net/learn/extensions/url-rewrite-module/using-rewrite-maps-in-url-rewrite-module

    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:

    https://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis

    Best Regards,

    Yuk Ding

    Monday, November 14, 2016 1:56 AM
  • User-1265545611 posted

    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}" />
    </rule>

    I setup Failed Request Tracing but I just see the 404 error without any additional information:
    https://i.imgur.com/orXnW1n.png

    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.

    Regards,
    TheRaspyDev

    Thursday, August 13, 2020 8:41 AM