Skip to content
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

HTTP triggered functions with reserved names in a route cause 404 #3734

Closed
troyhunt opened this issue Nov 5, 2018 · 4 comments
Closed

HTTP triggered functions with reserved names in a route cause 404 #3734

troyhunt opened this issue Nov 5, 2018 · 4 comments

Comments

@troyhunt
Copy link

troyhunt commented Nov 5, 2018

Consider an HTTP triggered function with a route like this: mypath/{myparam}

Now pass a param to the route that matches one of the reserved names listed here followed by a dot: https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file

For example, mypath/con.foo

Calling this route causes Azure to return 404. This doesn't happen when tested locally yet appears consistently in Azure. There's a Twitter thread documenting this here: https://twitter.com/troyhunt/status/1059254759293542400

It's also discussed (and excellently explained!) in a thread from only a couple of days ago here: https://twitter.com/Foone/status/1058676834940776450

The behaviour can be reproduced in a live Azure Function via this URI: https://api.haveibeenpwned.com/unifiedsearch/con.foo@example.com

Substituting the alias of the email address in that path will either return HTTP 200 with a valid JSON body or HTTP 404 with a CORS header returned by the function itself.

Expected behaviour is that the param is successfully passed to the function and not blocked.

@davidebbo
Copy link
Contributor

To fix this, we need to set <httpRuntime relaxedUrlToFileSystemMapping="true"/> in web.config (here). This post explains the behavior: https://haacked.com/archive/2010/04/29/allowing-reserved-filenames-in-URLs.aspx/.

Note that I would expect this to be a v1 only issue, since v2 uses .NET Core, which should allow this by default.

@fabiocav
Copy link
Member

fabiocav commented Nov 5, 2018

The difference in behavior is likely due to the hosting model differences between local and prod (direct/self-hosted vs IIS/in-proc).

@fabiocav fabiocav added this to the Triaged milestone Nov 5, 2018
@fabiocav
Copy link
Member

fabiocav commented Nov 7, 2018

Quick PR with @davidebbo's recommended fix here: #3750

@fabiocav
Copy link
Member

Resolved by #3750

@Azure Azure locked as resolved and limited conversation to collaborators Dec 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants