Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need help for this problem. My django applications using mod_wsgi, apache and reverse proxy using nginx. the nginx is listen to port 80, and our apps is live inside VPS. And the MOD WSGI is in 127.0.0.1:8081. nginx proxy passed request to 127.0.0.1:8081.

One day, our administrator give us IP 210.201.201.200:8050 ( this IP is dummy ).

What I face, in nginx it still listen to port 80, not 8050, and it works for opening the login page for first time(request.GET) and able to browse. But, when I click submit, it always redirect to 210.201.201.200:80, so error 404 always occured. (there is another application in 210.201.201.200:80)

In short, I open http://210.201.201.200:8050, click submit, it redirect to http://210.201.201.200:80, and error 404.

Can someone please help me, explain whats wrong here? My administrator blamed my webserver, and said that it (django platform, nginx or whatever lah) only can perform in port 80.

And please give me feedback, what is the solution of my problem?

Please help me. Thank you

share|improve this question

migrated from stackoverflow.com Aug 25 '11 at 21:10

This question came from our site for professional and enthusiast programmers.

1 Answer 1

For this to work at all times, you should redirect to http://hostname:port/path, not just /path. When using django.contrib.auth, you can override e.g. LOGIN_REDIRECT_URL in settings.py.

Generally, you could use contrib.sites framework and pass Site.objects.get_current().domain where needed.

share|improve this answer
    
Hi ayanami, I think my explanation is not very complete. Sorry about that. so the problem is, there is two kind of IP address. The external one, and internal one. –  cactuarz Aug 26 '11 at 2:20
    
The external ( public ) one is 210.201.201.200:8050. It listened by NGINX, but in port 80. Why is that, doesn't have a clue. Is that something called tunneling? Confused The internal IP is 127.0.0.1:8081. It used by mod wsgi. So the flow is, user send to 210.201.201.200:8050, it received by NGINX in port 80 and proxy passed it to 127.0.0.1:8081. What I confused is, why every submit, it redirect to 210.201.201.200:80? –  cactuarz Aug 26 '11 at 2:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.