As the title described, Django keeps changing my URL from /localhost/ to /127.0.0.1:8080/ which keeps messing up my serving static files by Nginx. Any ideas why its doing this? Thanks!
/**EDIT**/
Here is the Nginx configuration:
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$
{
root /srv/www/testing;
}
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex on;
}
Here is Apache config file:
<VirtualHost *:8080>
ServerName testing
DocumentRoot /srv/www/testing
<Directory /srv/www/testing>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /srv/www/testing/apache/django.wsgi
</VirtualHost>
edit2:
http://wiki.nginx.org/HttpProxyModule#proxy_redirect
http://wiki.nginx.org/HttpProxyModule#proxy_pass
What I think is happening is when you use your
httpresponseredirect, theHTTP_HOSTheader is giving it the127.0.0.1:8080, because of yourproxy_passsetting.Django's HttpResponseRedirect seems to strip off my subdomain?