Proxy_redirect problems

This might be simple and related to the fact that I have been working
way too many hours in the last 4 weeks.
If it is, please forgive.

We have:

rewrite ^/$ /admin;

which is then handled by:

location /
{
    index index.html index.htm;
    try_files $uri $uri/ @seaside;
    error_page 403 = @seaside;
}

location @seaside
{
    proxy_pass http://gemstone;
}

upstream gemstone
{
   server 127.0.0.1:8080;
}

Urls after the first /

appear as

hostname/admin

want it to just be

hostname/

but cant get.

have tried:

proxy_redirect http://127.0.0.1:8080/admin/ /;
proxy_redirect http://gemstone:8080/admin/ /;
proxy_redirect http://gemstone/admin/ /;

and none work.

have done many times in the bygone days in apache but never
in nginx. can someone point out what i’m doing wrong?

On Tue, Dec 29, 2009 at 4:37 PM, merlin corey [email protected]
wrote:

You don’t need this rewrite and what it does is cause the behavior
that you say you don’t want :P.

Try this seaside location instead:
location @seaside {
 proxy_pass http://gemstone/admin;
}

You might then need to play with proxy_redirect values and/or try with
trailing slash.

i then get this error:

Restarting nginx: [emerg]: “proxy_pass” may not have URI part in
location given by regular expression, or inside named location, or
inside the “if” statement, or inside the “limit_except” block in
/ah/sites/ops/conf/nginx.conf:38

config is this:

location /
{
    index index.html index.htm;
    try_files $uri $uri/ @seaside;
    error_page 403 = @seaside;
}

location @seaside
{
    proxy_pass http://gemstone/admin;
}

apparently adding admin there isnt an option.

Hello,

On Tue, Dec 29, 2009 at 1:26 PM, Sean A.
[email protected] wrote:

This might be simple and related to the fact that I have been working
way too many hours in the last 4 weeks.
If it is, please forgive.

We have:

rewrite ^/$ /admin;

You don’t need this rewrite and what it does is cause the behavior
that you say you don’t want :P.

Try this seaside location instead:
location @seaside {
proxy_pass http://gemstone/admin;
}

You might then need to play with proxy_redirect values and/or try with
trailing slash.

GET SOME SLEEP!
– Merlin

On Tue, Dec 29, 2009 at 2:25 PM, Sean A.
[email protected] wrote:

rewrite ^/$ /admin;
trailing slash.
location /

apparently adding admin there isnt an option.


nginx mailing list
[email protected]
nginx Info Page

Hello,

Ach, sorry it is has been a very long time since I dealt with proxying
(mostly using fastcgi backends these days) and I forgot about the path
problem in regex and internal locations.

I’m not sure offhand how you might otherwise do this within a single
server block but I can think of an ugly hack where you add a fake
internal server block…

At any rate maybe you will find something in the documentation here:
http://wiki.nginx.org/NginxHttpProxyModule

Apologies and good luck,
Merlin

changing to proxy redirect to:

proxy_redirect  /admin  /;

works.