Esri / resource-proxy

Proxy files for DotNet, Java and PHP.
Apache License 2.0
372 stars 321 forks source link

Make Referrer Path case insensitive #543

Closed jeremiahsa closed 3 years ago

jeremiahsa commented 4 years ago

When testing the .NET resource proxy, it was discovered that capital letters in the URL prevented the proxy from recognizing it. This fix makes the URL case insensitive.

bsvensson commented 4 years ago

Hi @jeremiahsa - thank you for submitting this PR. Could you provide some more information for us?

Thank you

jeremiahsa commented 4 years ago

This PR specifically solves the problem that http://examplesite.com is treated differently than http://ExampleSite.com. It turns out for our use case, there were links out there with letters in different cases to make the URL more readable. This allows the config path to have just the all lowercase variety to be specified in the allowedReferers property of proxy.config.

To reproduce the original issue, install the proxy over a secured ESRI map service, using allowedReferers="https://baseURL.mysite.com" to serve the project and navigate to "https://baseurl.mysite.com" on the browser. The network tab should show a 403 error. Take the URL from the network tab and open it in a new tab and it should display the requested map feature or feature layer JSON.

Note: Because this is employed with software in a private network, my specific URLs are different, but they wouldn't be useful outside of our network anyways.