Proxy with URI and params

Hi,

I need to make a proxy solution. But I having some problems.

When the type www.example.com/delivery/a/b/c I need to make a proxy to
www.proxy.com/delivery/a/b/c/?var1=A&var2=B

So a did this configuration

location /delivery {
subs_filter http://www.example.com/$uri
http://www.proxy.com/$uri/?var1=A&var2=B;
proxy_pass http://www.proxy.com/$uri/?var1=A&var2=B;
}

Why it not working ?

Thanks and sorry for my English.


Robson Roberto Souza Peixoto
Robinho
Master in Computer Science, University of Campinas
Linux Counter #395633
IRC: robsonpeixoto
Twitter: http://twitter.com/rrspba
github: https://github.com/robsonpeixoto

On 16 Jan 2012 19h56 WET, [email protected] wrote:

subs_filter http://www.example.com/$uri
http://www.proxy.com/$uri/?var1=A&var2=B;
proxy_pass http://www.proxy.com/$uri/?var1=A&var2=B;
}

Why it not working ?

Because the HTTPSubModule replaces something on the request body not
on the configuration.

I suppose you want something like this:

server {
server_name www.example.com;

location /delivery {
proxy_pass http://www.proxy.com$uri/?var1=A&var2=B;
}
}

$uri already starts with a ‘/’.

— appa

Thanks Antonio.

Now the problem is with the images, css and others thinks.
When the site is loaded, it try to download from www.example.com, and
not
from www.proxy.com.

For example, the browser try to get the www.example.com/menu.css, but
the
correct is try to download the www.proxy.com/menu.css.

How to fix it?

Thanks

On Mon, Jan 16, 2012 at 6:06 PM, António P. P. Almeida
[email protected]wrote:

$uri already starts with a ‘/’.

— appa


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx


Robson Roberto Souza Peixoto
Robinho
Master in Computer Science, University of Campinas
Linux Counter #395633
IRC: robsonpeixoto
Twitter: http://twitter.com/rrspba
github: https://github.com/robsonpeixoto

On 16 Jan 2012 21h54 WET, [email protected] wrote:

[1 <multipart/alternative (7bit)>]
[1.1 <text/plain; UTF-8 (quoted-printable)>]
Thanks Antonio.

Now the problem is with the images, css and others thinks. When the
site is loaded, it try to download from www.example.com, and not
from www.proxy.com.

For example, the browser try to get the www.example.com/menu.css,
but the correct is try to download the www.proxy.com/menu.css.

Then you need to be clear on what you want.

Perhaps you just and to proxy_pass to another host. Or if you want to
have other stuff like images and such try:

location /delivery {

location ~* /delivery/[^/]*.\(?:css|js|gif|jpe?g|png)$ {
    proxy_pass http://www.proxy.com;

}

proxy_pass http://www.proxy.com$uri/?var1=A&var2=B;

}

I’m just guessing. We could help you more if stated more clearly
what’s your purpose.

— appa

On 17 Jan 2012 11h27 WET, [email protected] wrote:

I’d like to navigate on http://www.proxy.com/delivery/.../.../.../
using my domain http://www.example.com/.

So the user will navigate on www.example.com and always show on URL
the ’ www.example.com/delivery/../../…’

It’s is possible?

Yes. Add the proxy_redirect directive:

proxy_redirect http://www.proxy.com/delivery/ http://www.example.com/;

See: http://wiki.nginx.org/HttpProxyModule#proxy_redirect

— appa

On Mon, Jan 16, 2012 at 11:04 PM, António P. P. Almeida
[email protected]wrote:

not from www.proxy.com.

For example, the browser try to get the www.example.com/menu.css,
but the correct is try to download the www.proxy.com/menu.css.

Then you need to be clear on what you want.

I’d like to navigate on http://www.proxy.com/delivery/.../.../.../ using
my
domain http://www.example.com/.

So the user will navigate on www.example.com and always show on URL the

www.example.com/delivery/../../…’

It’s is possible?


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx


Robson Roberto Souza Peixoto
Robinho
Master in Computer Science, University of Campinas
Linux Counter #395633
IRC: robsonpeixoto
Twitter: http://twitter.com/rrspba
github: https://github.com/robsonpeixoto

On 17 Jan 2012 00h41 WET, [email protected] wrote:

For example, the browser try to get the www.example.com/menu.css,
but the correct is try to download the www.proxy.com/menu.css.

Then you need to be clear on what you want.

Perhaps you just and to proxy_pass to another host. Or if you want
to have other stuff like images and such try:

location /delivery {

  • location ~* /delivery/[^/]*.(?:css|js|gif|jpe?g|png)$ {
  • location ~* /delivery/[^/]*.(?:css|js|gif|jpe?g|png)$ {

— appa

Thanks for the tips. This solutions is a little slow, so
I’m studding another way to solve it.

Thanks a lot.

On Tue, Jan 17, 2012 at 10:50 AM, António P. P. Almeida
[email protected]wrote:

Yes. Add the proxy_redirect directive:
http://mailman.nginx.org/mailman/listinfo/nginx


Robson Roberto Souza Peixoto
Robinho
Master in Computer Science, University of Campinas
Linux Counter #395633
IRC: robsonpeixoto
Twitter: http://twitter.com/rrspba
github: https://github.com/robsonpeixoto

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs