Wednesday, 15 February 2012

django - Port number getting stripped out of URL -



django - Port number getting stripped out of URL -

i have django based website that's presented through gunicorn nginx reverse proxy. it's on port 81.the relevant portion of configuration file looks this:

upstream elearning_server { server localhost:8000; } server { hear 81; ......

if go to:

http://webaddress:81

the first time after log in, removes port number , fails connect website. if set port number url works fine.

has got suggestions of can seek prepare problem.

what happening web server, part of login process 'redirecting' browser different web address. problem web address browser beingness redirected doesn't exist, because beingness redirected wrong web address. when modify web address, correcting error.

obviously solution right problem in code, sent straight right web address without needing right this.

the solution depends on code. worth looking @ next in mind.

is there like:

return httpresponseredirect('http://website/dir/')

in code somewhere? need altered include port number, i.e

return httpresponseredirect('http://website:81/dir/')

or, better,

return httpresponseredirect('/dir/')

(this mean won't matter port server on, because redirect 'relative'. usual way code sort of thing.)

if quick perusal of source doesn't cast light, suggest next step in access logs (and maybe error logs) web server, , '3xx' type messages, '301' , '302' messages, , may give clue happening, , in code.

django nginx gunicorn

No comments:

Post a Comment