I'm deploying a Django website on an Azure website, following the Django Azure tutorial. Everything works fine, except for one URL: my only URL that accepts spaces.
When I request https://mysite.azurewebsites.net/root/path/this%20is%20a%20parameter (and I've checked that the query is sent with %20 - not a space or a double encoding), the PATH_INFO inside Django is actually /root/path/this%20is%20a%20parameter. While in my understanding it should be decoded with spaces instead of %20 - IIS (actually, http.sys) being responsible for the decoding.
It works perfectly with the debug server. But in Azure IIS, since the value is botched, my application crashes.
When using a query parameter (?key=value) there are no problems either (which is logical since IIS does not touch that part).
Inside the access logs, oddly I find plus signs (+) instead of %20 or spaces: GET /root/path/this+is+a+parameter (very odd since + are not legal in that part of the URL, perhaps it's only a logging artifact?)
Finally, I'm not using any form of rewrite - I have directly mapped the FastCGI handler to this URL to avoid any confusion.
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="WSGI_ALT_VIRTUALENV_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
<add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="D:\home\site\wwwroot\env\Scripts\activate_this.py" />
<add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_virtualenv_handler()" />
<add key="PYTHONPATH" value="D:\home\site\wwwroot" />
<add key="DJANGO_SETTINGS_MODULE" value="MYAPP.settings" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
</system.web>
<system.webServer>
<handlers>
<add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\Python27\python.exe|D:\Python27\Scripts\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
Would anyone have encoutered this and be able to retrieve the decoded value? Thanks!
In the end it was a bug in the Azure provided IIS handler for WSGI (a WSGI/FCGI bridge). I've opened a bug in their GitHub