-
Notifications
You must be signed in to change notification settings - Fork 455
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
Route constraints which contain a period do not work without trailing '/' #969
Comments
We've tried two things that seem to fix it:
or
But we'll need to make sure this doesn't regress cold start perf and functionality. edit also found a http handler solution: http://stackoverflow.com/a/12151501/5915331 |
Notes from triage: we suspect no perf impact on routes that we already handle, but we should do perf tests to confirm. |
This is a problem with wildcards as well (I'm using node.js):
This works fine for any route unless the route has a filename with extension at the end (with or without query string). Adding a trailing / does fix it. Since I am using node.js, I'm not sure how to control the IIS settings mentioned above that are normally controlled by web.config. Note: I also found another web.config setting mentioned that could be relevant:
From: http://stackoverflow.com/questions/294495/semantic-urls-with-dots-in-net#328873 Anyway, any ideas how to work around this for node.js? |
@safihamid mentioned on stackoverflow that the dot issue - at least for functions proxies - is fixed now. unfortunately it still does not work for me (i restarted the function app).
|
@mikezks please make sure you have updated the proxy version to ~0.1. I verified the above works with the latest versin |
Yes! The final piece to the puzzle! Thanks Azure Functions team! I can confirm this is working: https://test-azure-functions-proxies.azurewebsites.net/file/file.json Does this work only with proxies, or can this work with the normal function route as well? |
@safihamid: |
I just noticed that the dot issue still occurs for Azure Functions routing. Though this is not a big issue for me because we now have the workaround with Functions Proxies, this needs to be fixed one day. Thanks! |
Indeed, I'm facing this in functions routing. I've got:
As soon as the client url contains a dot in any of the url patterns (i.e. |
@lindydonna fair. Still, the dot is broken if it shows up in any of the url patterns :(. Any suggested workarounds? |
btw, I was hoping uploading a |
Given the following proxy definition:
I see the following:
(with appropriate URL escaping performed by the browser itself, they all fail with or without a trailing Makes the routing very very brittle. Note: I was looking for a way to turn the problematic dots into some fairly uncommon char just for routing and inside the function convert it back, and that's how I found that it's broken for at least a whole bunch of other chars. |
Please try adding a slash in your proxy's config: |
Below is how I do it with proxies, and it seems to handle dots fine. (I think the trick is to route the params to a query string which doesn't blow up the Function routing.) (I use this for static file serving to a CDN and also something like this for my SPA apps where the app does internal routing.) I use a wildcard and it seems to handle all sub routes which can be passed to a function. Also, if you leave the route "" (blank), you can override the root index page. (But you have to edit the {
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"Static": {
"matchCondition": {
"route": "static/{*file}"
},
"backendUri": "https://told-stack-demo.azurewebsites.net/api/static?file={file}"
},
"Root": {
"matchCondition": {
"route": "",
"methods": [
"GET"
]
},
"backendUri": "https://told-stack-demo.azurewebsites.net/api/static?file=demo/"
}
}
} Example:
Also, I tested the error cases, and the proxy sent them to the function correctly (where the file was not found so the function reported a File Path Error): |
That's cheating ;). I also got it to "work" by having one route that consumes everything with So, a "catch-all" route on the proxy, and no |
True, it would be nice if the function routing could accept any valid URL value. (For example when doing Function Binding with BlobNames, it would likely have a dot in the parameter.) At least the proxy can function as a work around, which we didn't have a few months ago. |
Ran into this while building an HTTP API with dots in the route.
Its not as common but is definitely legal routing. I agree the route should allow any valid URL. |
Indeed @codeitcody |
Functions does not handle such requests. This is covered in issue #969 (comment)
@mathewc any ideas when this is hitting production? |
@kzu it's partially deployed. If you have the cycles, you can verify it in North Central US. It should reach everywhere on Tuesday. |
If you try to define a custom route
products/{category:alpha}/{id:regex(\d+.\d+.\d+)}
it will match requests likehttps://function-fun.azurewebsites.net/api/products/electronics/1.2.3/
but nothttps://function-fun.azurewebsites.net/api/products/electronics/1.2.3
(no trailing slash).The text was updated successfully, but these errors were encountered: