Issue
So I have a Django application server all set up using Apache and uWSGI and a proxy system. One small problem...Something keeps changing my hostname!!!
It almost resembles a rewrite rule but I searched my httpd.conf and couldn't find any that fits the bill. Whenever I send an HTTP URL:
http://www.example.com/polls
Django receives this url from the proxy:
http://www.example.com/kpolls
It's really annoying! something keeps adding that damn k
to my hostname and I have no idea what! Please help!
Some extra info:
So my proxy so far is pretty simple:
ProxyPass "/" "uwsgi://127.0.0.1:49152/var/run/app_name.sock"
ProxyPassReverse "/" "uwsgi://127.0.0.1:49152/var/run/app_name.sock"
(tried localhost
and www.example.com
just to be sure. no effect so hostname is resolving correctly.)
Seems to me that the proxy is altering it before handing the request off to Django?
Solution
Figured it out FINALLY!
Turns out it was my use of UNIX socket notation in the proxy and in the .ini config file. In a nutshell, I had the following:
ProxyPass "/" "uwsgi://127.0.0.1:49152/var/run/app_name.sock"
ProxyPassReverse "/" "uwsgi://127.0.0.1:49152/var/run/app_name.sock"
And I needed to get rid of some of it to look like this:
ProxyPass "/" "uwsgi://127.0.0.1:49152"
ProxyPassReverse "/" "uwsgi://127.0.0.1:49152"
because I was using the uwsgi
protocol through my apache mod_proxy_uwsgi
install which automaticaly links it up to the running uWSGI instance but the full request/path was mapping to a .sock
file commonly used in UNIX socket methods (Oh, turns out my apache version cant handle unix://
requests yet). Basically, I was using some weird hybrid of a UNIX socket and uWSGI proxy protocol which was confusing the server and adding the erroneous letter to every GET
request
Answered By - Graeme Ford Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.