Re: How to proxy everything except selected urls?
Ken Miller wrote: >I the past, when I've setup a proxy/app server configuration, it's always >been to forward certain url's to the app server, with the rest being >processed by the proxy. > >However, I need to turn this around. I want to pass everything to the app >server, except for some url's that point at static content (images, mostly). > >I initially thought something like this would work: > >--- >ProxyPass On >ProxyPass / http://other.server.com:1234/ >ProxyPassReverse / http://other.server.com:1234/ > >alias /graphics /local/path >--- > >However, /graphics also get's proxied to the app server. This isn't what I >want. > I actually have had to do this myself... The solution is as follows: ProxyPass/staticstuff/! ProxyPass/ http://other.host/ ProxyPassReverse / http://other.host/ ! is a special symbol telling it not to proxy that stuff - also, I think order counts (eg, do !s first) Issac Issac
Re: How to proxy everything except selected urls?
> "Ken" == Ken Miller <[EMAIL PROTECTED]> writes: Ken> I initially thought something like this would work: Ken> --- Ken> ProxyPass On Ken> ProxyPass / http://other.server.com:1234/ Ken> ProxyPassReverse / http://other.server.com:1234/ Ken> alias /graphics /local/path Ken> --- Ken> However, /graphics also get's proxied to the app server. This isn't what I Ken> want. Ken> I don't think mod_proxy can do this; at least it's not clear to me how to if Ken> it does support this feature. Ken> Would mod_rewrite be a better solution? Match on the URL's that I want Ken> processed locally (and stop), else map the url to the app server, and Ken> forward the request? Here's what the reverse-caching-proxy front end for www.stonehenge.com uses: RewriteEngine On ## RewriteLog /web/stonehenge-proxy/var/log/rewrite_log ## RewriteLogLevel 3 ## local services: RewriteRule ^/icons/ - [last] RewriteRule ^/tt2/images/ - [last] ## local redirect: RewriteRule ^/cgi/go/(.*)$ $1 [redirect,last,noescape] ## passthrough: RewriteMap escape int:escape RewriteRule ^/(.*)$ http://localhost:8081/${escape:$1} [proxy,noescape] ProxyPassReverse / http://localhost:8081/ ## made a mistake! should never get here RewriteRule .* - [forbidden] By the way, without that RewriteMap, %3F in a URL incorrectly becomes "?", thus ending the path-part and begins the query-part. Bad. Broken. But this workaround works fine. And the examples in the mod_rewrite documentation are wrong. I figured this out while rebuilding http://www.stonehenge.com/merlyn/Pictures/ to work with images that had spaces in the filenames as well as question marks and ampersands. :) Talk about escaping hell. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
How to proxy everything except selected urls?
I the past, when I've setup a proxy/app server configuration, it's always been to forward certain url's to the app server, with the rest being processed by the proxy. However, I need to turn this around. I want to pass everything to the app server, except for some url's that point at static content (images, mostly). I initially thought something like this would work: --- ProxyPass On ProxyPass / http://other.server.com:1234/ ProxyPassReverse/ http://other.server.com:1234/ alias /graphics /local/path --- However, /graphics also get's proxied to the app server. This isn't what I want. I don't think mod_proxy can do this; at least it's not clear to me how to if it does support this feature. Would mod_rewrite be a better solution? Match on the URL's that I want processed locally (and stop), else map the url to the app server, and forward the request? What's the best way to do this? (in case you're wondering, the back-end app server will be generating most of the content dynamically; I could just have a set of heavy servers, but I'm trying to offload what I can to a lighter front-end. In the end, however, it may not be worth the effort, since the number of static files will be small compared to the dynamic content...) -klm.