Note that there are some explanatory texts on larger screens.

plurals
  1. POMicrosoft Azure appending extra query string to urls with query strings
    primarykey
    data
    text
    <p>In deploying a version of the Django website I'm working on to Microsoft's Azure service, I added a page which takes a query string like </p> <pre><code>http://&lt;my_site_name&gt;.azurewebsites.net/security/user/?username=&lt;some_username&gt;&amp;password=&lt;some_password&gt; </code></pre> <p>However, I was getting 404 responses to this URL. So I turned on Django's Debug flag and the page I get returned said:</p> <pre><code>Page not found (404) Request Method: GET Request URL: http://&lt;my_site_name&gt;.azurewebsites.net/security/user/?username=&lt;some_username&gt;&amp;password=&lt;some_password&gt;?username=&lt;some_username&gt;&amp;password=&lt;some_password&gt; Using the `URLconf` defined in `&lt;my_project_name&gt;.urls`, Django tried these URL patterns, in this order: ^$ ^security/ ^user/$ ^account/ ^admin/ ^api/ The current URL, `security/user/?username=&lt;some_username&gt;&amp;password=&lt;some_password&gt;`, didn't match any of these. </code></pre> <p>So it seems to be appending the query string onto the end of the url that already has the same query string. I have the site running on my local machine and on an iis server on my internal network which I'm using for staging before pushing to Azure. Neither of these site deployments do this, so this seems to be something specific to Azure.</p> <p>Is there something I need to set in the Azure website management interface to prevent it from modifying URLs with query strings? Is there something I'm doing wrong with regards to using query strings with Azure?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COI found another question that seems very similar to mine: http://stackoverflow.com/questions/12698625/query-string-get-appened-more-than-once But I'm not sure how to implement the suggested solution on Azure. Not the part about rewriting to force https, just the part that prevents the query string doubling.
      singulars
    2. COLooking into it further, I've tracked the problem down to the path_info variable. I'm using the WSGIHandler provided by Django using get_wsgi_application() in Azure as the WSGI_HANDLER app setting as this tutorial indicates I should be doing: http://www.windowsazure.com/en-us/develop/python/tutorials/web-sites-with-django/ . Looking at the information that handler receives from the environment variables though, it seems as though QUERY_STRING is empty and PATH_INFO has the full url + query string. Which seems to be causing my issues. Not sure if it's a problem with fastcgi or iis though.
      singulars
    3. COCorrection to the above comment. QUERY_STRING isn't empty. That was my fault in trying to get rid of the double query strings using url rewriting I removed the query string via Web.config file. The root of the issue now is just that PATH_INFO contains the query string and the Django WSGI handler is not expecting it to.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload