Pardon me if this is not the right place to ask.
I have a django app served by Gunicorn, which is reversed by NginX and this one is being reversed by an ISA server, so I have the following:
ISA --> Nginx --> Gunicorn
ISA reverses www.mydomain.com/some/path/here
to Nginx, and this one reverses /myapp
to Gunicorn (nginx and gunicorn are on the same server).
The problem is with the url, for instance the base url to access this apps is
www.mydomain.com/some/path/here/myapp/
When there's an action in a django view like redirect e.g: redirect(reverse('start'))
,
the url should be
www.mydomain.com/some/path/here/myapp/start/
but I get
www.mydomain.com/some/path/here/some/path/here/myapp/start/
As you can see some/path/here/
is being repeated, I'm assuming this is done by the ISA server, but I'm not sure about this. What am I doing wrong here?
In my settings.py I have:
BASE_PATH = '/some/path/here'
FORCE_SCRIPT_NAME = BASE_PATH + '/myapp'
LOGIN_URL = FORCE_SCRIPT_NAME + '/loginhere/'
urls.py:
...
url(r'^start/', 'testapp.views.start', name='start'),
...
My nginx.conf:
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
upstream wawared {
server 127.0.0.1:8000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/wawared.access.log;
error_log /var/log/nginx/wawared.error.log;
location /static {
root /path/to/static/files;
expires 1d;
gzip on;
}
location /myapp/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8000/;
proxy_redirect off;
}
}
}