Like the nginx named locations configuration. Looks like it might be what I need. Thanks!
On Wed, Jun 9, 2010 at 1:20 PM, David Birdsong <[email protected]> wrote: > On Wed, Jun 9, 2010 at 8:55 AM, Rapsey <[email protected]> wrote: >> I use it to dispatch to another app. As for ordering, I think you would need >> to do it from the app if I understand your use case correctly. >> >> >> Sergej > It's true that X-Accel-Redirect would require this chaining logic in > your app. If this is truly unpalatable, then both nginx and varnish > have ways to put the chaining in the proxy. > > nginx: > > location /location1 { > proxy intercept errors on; > error_page 404 = @location1miss; > } > > location @location1miss { > > rewrite ^.*$ /location2 > } > > ....etc > > varnish: > > vcl_recv { > if ($restarts == 0 ) { > set backend = backend0 > } else if $(restarts == 1) { > set backend = backend1 > } ....etc > } > > vcl_fetch { > > if (beresp.status == 404 && req.restarts <= N ) { > restart; > } > } > > i like varnish's easy management of the number of chains, and i use > all three(haproxy, varnish, and nginx), but i end up using nginx's > named locations to handle unwanted backend responses to try various > backend's. > >> >> On Wed, Jun 9, 2010 at 5:38 PM, Jonah Benton <[email protected]> wrote: >>> >>> Thanks for the rapid response. At first blush, X-Accel-Redirect >>> doesn't look to be quite what I need: >>> >>> * it appears that the specific use case is to dispatch to optimized >>> static file delivery; it's not clear whether the >>> dispatched-to-back-end can be another app, rather than something that >>> can be delivered with sendfile() >>> * assuming the dispatched-to-backend can be another app, can apps >>> arbitrarily chain themselves together with a series of >>> X-Accel-Redirect responses, or does nginx impose some sort of limit >>> * if apps can arbitrarily chain themselves together, this still means >>> I need to maintain the app ordering in the webapp rather than in the >>> proxy. The webapps are java, so this will be a little tricky, and the >>> chaining appears to have to be by path, which would be proxy-only >>> knowledge. >>> >>> So, maybe it's doable, though I'd rather be able to just maintain the >>> ordering in the proxy configuration. >>> >>> I'll look some more, though, thank you for the pointer. >>> >>> On Wed, Jun 9, 2010 at 2:58 AM, Rapsey <[email protected]> wrote: >>> > You can't do this with haproxy, but you can with nginx and >>> > X-Accel-Redirect >>> > >>> > >>> > Sergej >>> > >>> > On Wed, Jun 9, 2010 at 5:17 AM, Jonah Benton <[email protected]> wrote: >>> >> >>> >> Greetings, >>> >> >>> >> I have several web applications that each service different portions >>> >> of the same taxonomy. The taxonomy is very deep- millions of >>> >> resources- and the rules that dictate which part of the taxonomy each >>> >> application serves are fluid and changing. In general it isn't easy to >>> >> determine declaratively which web application should service which >>> >> uri. >>> >> >>> >> I'd like to set up a proxy dispatch hierarchy, such that requests >>> >> arriving at a proxy front end would be dispatched to one of the web >>> >> applications. The response from web application 1 would checked by the >>> >> proxy front end. If it's a 404, then the front end discards the >>> >> response from web application 1, and dispatches to the next web >>> >> application. If non-404, then the response is returned to the client >>> >> and the transaction is considered handled. A 404 response from the >>> >> last web application would be considered a true 404 and would get >>> >> returned to the client. >>> >> >>> >> From a quick look at the configuration, it doesn't appear that this >>> >> can be done with HAProxy (nor with any other proxy software I've >>> >> looked at). Am I wrong, can this be arranged? >>> >> >>> >> Please cc me, I'm not subscribed to the list. >>> >> >>> >> Thank you, >>> >> >>> >> Jonah >>> >> >>> > >>> > >> >> >

