

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
8 messages in ru.sysoev.nginxRe: Dynamic proxy_pass| From | Sent On | Attachments |
|---|---|---|
| W. Andrew Loe III | Jul 29, 2008 6:34 pm | |
| 张立冰 | Jul 29, 2008 6:57 pm | |
| mike | Jul 29, 2008 7:43 pm | |
| W. Andrew Loe III | Jul 30, 2008 10:22 am | |
| W. Andrew Loe III | Jul 30, 2008 2:08 pm | |
| mike | Jul 30, 2008 2:16 pm | |
| W. Andrew Loe III | Aug 1, 2008 1:46 pm | |
| mike | Aug 1, 2008 5:14 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Dynamic proxy_pass | Actions... |
|---|---|---|
| From: | mike (mike...@public.gmane.org) | |
| Date: | Jul 30, 2008 2:16:45 pm | |
| List: | ru.sysoev.nginx | |
cool!
so http://1.2.3.4/foo.jpg is actually the source file then?
On 7/30/08, W. Andrew Loe III <andrew-4trK/3dDa...@public.gmane.org>
wrote:
For those interested I have a working solution.
location /under_the_covers/ { if ($uri ~* ^/under_the_covers/(.*)/.*$) { set $other_nginx $1; rewrite ^/under_the_covers/.*/(.*)$ $1; proxy_pass http://$other_nginx/$uri; break; } }
My client replies with X-Accel-Redirect = /under_the_covers/1.2.3.4/foo.jpg and my other webserver gets the request.
On Tue, Jul 29, 2008 at 6:34 PM, W. Andrew Loe III
<andrew-4trK/3dDa...@public.gmane.org> wrote:
I have a relatively complex setup but I believe nginx has the ability to do everything I am looking for. I want to proxy requests for files to different servers using x-accel-redirect.
A request cycle might look like this: client => interwebs => nginx1 => mongrel (which does some lifting and then replies back with x-accel-redirect and a url like /under_the_covers/10.10.1.2/file.jpg) => nginx1 (at this point the location directive catch the /under_the_covers and do what I want) => some-other-webserver (10.10.1.2) => nginx1 => interwebs => client.
In psuedo code I want something like:
location /under_the_covers/(.*) { internal; proxy_pass http://$1; }
I have tried a few methods but I cannot seem to get it correct.
location /under_the_covers/ { rewrite ^/under_the_covers/(.*)/(.*)$ $2; proxy_pass http://$1; }
I have no trouble if I manually set the host in the proxy pass. So the mongrel replies with x-accel-redirect = /under_the_covers/file.jpg and location looks like so:
location /under_the_covers/(.*) { proxy_pass http://10.10.1.2; }
http://article.gmane.org/gmane.comp.web.nginx.english/6206/match=proxy_pass
There is discussion there on using proxy_pass with variables but I cannot either construct the uri correctly or I can't get the hostname set from a regular expression.
Thank you for your time, -- Andrew







