Forum: NGINX nginx reverse proxy odd 301 redirect

2974d09ac2541e892966b762aad84943?d=identicon&s=25 izghitu (Guest)
on 2013-10-06 00:17
(Received via mailing list)
Hi,

I have latest nginx which I am using as a reverse proxy for an
application
of mine running on apache on another server. The nginx config is like
this:
upstream upstreamname {
     server ip:port;
 }

....

location / {
    proxy_pass http://upstreamname;
    proxy_redirect off;
    proxy_set_header    Host    $host;
    proxy_set_header    X-Real-IP    $remote_addr;
    proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
}

...

So my problem appears with a certain change password script new users
must
use when they login first time after their username was created.

If I use apache directly then the change password script works fine. If
I do
it using nginx as reverse proxy then at the point where I press the
submit
button and the POST should happen, I can't see the POST hitting the
apache
backend(no entry in access log) but I can see an odd 301 redirect with
the
POST request to the script in the nginx access log.

Any idea of what could be the cause? Anything I am doing wrong?

Please help
Thanks

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,243458,243458#msg-243458
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-10-06 11:32
(Received via mailing list)
Hello!

On Sat, Oct 05, 2013 at 06:16:24PM -0400, izghitu wrote:

> location / {
> use when they login first time after their username was created.
>
> If I use apache directly then the change password script works fine. If I do
> it using nginx as reverse proxy then at the point where I press the submit
> button and the POST should happen, I can't see the POST hitting the apache
> backend(no entry in access log) but I can see an odd 301 redirect with the
> POST request to the script in the nginx access log.
>
> Any idea of what could be the cause? Anything I am doing wrong?

As long as the above configuration is a _full_ configuration of a
server{} block, there shouldn't be any 301 redirects returned
directly by nginx.  Most likely what you observe is a result of
incorrect configuration of server{} blocks and/or wrong hostname
used in request.

If it's not a full configuration - there isn't enough information
to provide any help.  See here for some tips what can be useful:

http://wiki.nginx.org/Debugging#Asking_for_help

--
Maxim Dounin
http://nginx.org/en/donation.html
2974d09ac2541e892966b762aad84943?d=identicon&s=25 izghitu (Guest)
on 2013-10-07 00:04
(Received via mailing list)
Hi,

The problem was hostname related.

Thanks for your help

> incorrect configuration of server{} blocks and/or wrong hostname
> used in request.
>

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,243458,243466#msg-243466
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.