Could Nginx redirected proxied traffic?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have configuration like this :

… snip …
location /monitor {
proxy_pass http://backend:6800/;
proxy_redirect default;
}
… snip …

Trying to access /monitor, it’s works. But, I tried to access URL
behind them, /monitor/logs/, /monitor/jobs/ it’s error 404, the log said
:

ip.ad.dr.es - - [13/Sep/2014:16:42:35 +0700] “GET /logs/ HTTP/1.1” 404
599 “http://engine.xtremenitro.org/monitor” “Mozilla/5.0 (X11; Linux
x86_64; rv:31.0) Gecko/20100101 Firefox/31.0”
ip.ad.dr.es - - [13/Sep/2014:16:45:24 +0700] “GET /jobs HTTP/1.1” 404
599 “http://engine.xtremenitro.org/monitor” “Mozilla/5.0 (X11; Linux
x86_64; rv:31.0) Gecko/20100101 Firefox/31.0”

But, if I try to access them directly through port 6800 (traffic not
proxied from nginx), everything works. I assume, that actually the
backend support rewrite URL, but while proxied, the rewrite URL didn’t
works.

Any hints?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJUFBKPAAoJEEyntV5BtO+Q3bAH/RCUkGSFkuLWt0Rgefuh60VE
yGxkXDhCa6BnO7Zv4VsvDb6XSYfax/qlmoIL5Grii5GfpjI4Rp3K6rR738JPqIM3
yd3DGmBOJPxPsenf5CFBofXi2k8KxyhSoJDXj9yZ6oszLNZ8JKYYQvIYSbMiqw4/
IMDmhGDHDVuhZB7zhxmxMrFWAn7B6UOuabd+Db3L7tpti1sLAdIkmOSXO+9CVAXA
A+ihW1J717K02YK4MO4ycS+Zgz++SC7+nSESpna1+n+UR+ix4NeUo0wDMlhGjkpZ
EHWEa5masuNHfXsURcPdzRIMn5IkPiV64WrEvFMN7QvUYgLDSxb8ezHzAg0SBcU=
=OGrl
-----END PGP SIGNATURE-----

On Saturday 13 September 2014 16:46:56 Dewangga wrote:

But, if I try to access them directly through port 6800 (traffic not
proxied from nginx), everything works. I assume, that actually the
backend support rewrite URL, but while proxied, the rewrite URL didn’t
works.

Any hints?

When you access it directly, what URI do you use?

wbr, Valentin V. Bartenev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

The original URI is :

http://engine.xtremenitro.org:6800/jobs
http://engine.xtremenitro.org:6800/logs

… etc

And if proxied, should be:
http://engine.xtremenitro.org/monitor/jobs
http://engine.xtremenitro.org/monitor/logs

… etc

I want to close the unusual port, and proxied to nginx. So I can
control the logs only from nginx.

Is it possible?

On 09/13/2014 05:29 PM, Valentin V. Bartenev wrote:

the log said :
not proxied from nginx), everything works. I assume, that
_______________________________________________ nginx mailing list
[email protected] nginx Info Page

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJUFBykAAoJEEyntV5BtO+QBloH/RS2fyv7C+RhFLRPZsN5gxB1
XHexEkM9aGo7JwIXAb9JzvkDp6Mm0IGky6v+zWZxZdtHuAWXG5wg29u1BCQvgiUI
Zdd9jRfCswMyI4zN+JE7l89URtrGhWPjfqciV69rZApq5pKbaedYkEve8J4jZrL1
wseeWLe9BP3OlOtO/OmcmDL/bdqRgPrmNdnKssAYJ5RXt0QlGpbD2JMqc5K9c8sQ
t6fwBLKZrjyJsajUE9tY6K0N2xkLTeBkBEvkX16jrdz7Q6xtTysGFm2LrpXSxnAr
8zuCR1Gjt1HuVxwtQD7bW5PlvgTd6x7vG1iT2/nacdt89WVXz1DOmwokCYuxC3I=
=8w6/
-----END PGP SIGNATURE-----

On Saturday 13 September 2014 17:29:57 Dewangga wrote:

http://engine.xtremenitro.org/monitor/jobs
http://engine.xtremenitro.org/monitor/logs

… etc

I want to close the unusual port, and proxied to nginx. So I can
control the logs only from nginx.

Is it possible?

First of all, with your config:

location /monitor {
    proxy_pass http://backend:6800/;
    proxy_redirect default;
}

“/monitor” part of URI is replaced with “/”,
so requesting “/monitor/logs/” results in a
request to “//logs/”, and I’m not sure that
your backend is able to handle that.

Please, check the documentation:
http://nginx.org/r/proxy_pass

Probably, all you need is just this:

location /monitor/ {
proxy_pass http://backend:6800/;
}

wbr, Valentin V. Bartenev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi bro,

It works! Thanks in a bunch!

On 09/13/2014 05:42 PM, Valentin V. Bartenev wrote:

And if proxied, should be:

I have configuration like this :
"Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101
Any hints?

_______________________________________________ nginx mailing
list [email protected]
nginx Info Page

_______________________________________________ nginx mailing list
[email protected] nginx Info Page

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJUFB+qAAoJEEyntV5BtO+QId4IAIRv2rg+rJuWG7iQkETKINHZ
pS5tDgao7HpmerXi779iiiER/o/o/9dQ+kNtmMHktRp+AdFGDpQM0dgt1In79GbQ
vA86hjMhPkboNMF0Ft5m30FS0tLQTEsn408Sh5MdRSr1REQ7llGZSIxzv8nGn9Ie
6qeOkIKuf/9Ooba+JMjP8lAZvEK7tO/OsajL02voCA9f76FFm5Gt+PGp7uoDtWWG
WFKLjiEKjq6arhajU7gGMAWvjFYdSyEoGoxxFJ4mPUXQNHGI6xMk44S9D8aDqbJa
hs1fJ9mIN4rXvJdQAYFE3w33KK9kEqAJnkSlwwTcQmtp2IVX7owQ0YytCXDYLTk=
=j+fG
-----END PGP SIGNATURE-----