-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URLEncoded route parameters are not respected #217
Comments
Thanks for the report. This looks like iisnode propagating the URL path that had been normalized by IIS to node.exe. Let me look into this. |
The normalization appears to happen in Express.JS itself. Neither URL Rewrite module or iisnode affect the URL path. You can validate this with this simple non-express application: server.js:
web.config:
|
Hi, How did you resolved this issue? I'm experiencing the same and not able to resolve it. |
I also experience the same issue. |
I used a work around by encoding characters myself. In my case input was predictable so I could do it. I'm no longer running on Windows so never pursued this further. |
I tried this example, and got different behavior when running under iis and under node. They only change i made to the code is adding the default port:
The response when running node app.js is: And this is what I get under IIS: |
@tjanczuk: I was able to replicate the same thing that @eugeneagafonov did, it seems like the problem is not in Express. Could we maybe try to get #486 in? |
There is a workaround that seems to be working (let's just hope PR #486 gets accepted soon) When URL Rewrite Module rewrites the url it sets the server variable The workaround is then to overwrite <serverVariables>
<set name="HTTP_X_ORIGINAL_URL" value="{UNENCODED_URL}" />
</serverVariables> Example: <rewrite>
+ <allowedServerVariables>
+ <add name="HTTP_X_ORIGINAL_URL" />
+ <add name="UNENCODED_URL" />
+ </allowedServerVariables>
<rule name="myapp">
<match url="myapp/*" />
<action type="Rewrite" url="hello.js" />
+ <serverVariables>
+ <set name="HTTP_X_ORIGINAL_URL" value="{UNENCODED_URL}" />
+ </serverVariables>
</rule>
</rewrite> You might need to unlock the <section name="allowedServerVariables" overrideModeDefault="Deny" /> to <section name="allowedServerVariables" overrideModeDefault="Allow" /> or, better, allow only for <location path="YourSite" overrideMode="Allow">
<system.webServer>
<rewrite>
<allowedServerVariables />
</rewrite>
</system.webServer>
</location> About the server variables
|
@HCanber Did not work for me. I still have |
@SomaticIT are you trying that on Azure? Anyway, run a test nodejs app which prints out UNENCODED_URL server variable. Please ensure that you have the following line in web.config: |
@eugeneagafonov Yes it's on Azure. |
I'm also experiencing this issue with an Azure web app. |
%2F interpreted as / when routing
As an example, the URL:
gets interpreted as:
resulting in
because of the extra / being interpreted when routing.
I am not sure whether this is happening during URL Rewriting (doubt it) or when iisnode talks to node.exe.
This does not happen when running node with express directly.
The text was updated successfully, but these errors were encountered: