Search code examples
apache.htaccessmod-rewritemod-proxy

htaccess proxy flag "immediate"


We have a series of pages that take between 10 and 30 seconds to load, which caused our apache connections to exceed the maximum number of connections. Since these pages are subpages of our site with data that is not too important, we decided to direct them to a second server where we don't care if the max connections are hit/overloaded.

To accomplish this we used the P flag in our htaccess file. In the doc it says

Use of the [P] flag implies [L] - that is, the request is immediately pushed through the proxy, and any following rules will not be considered.

-http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_p

Does anyone know if the connection is dropped on the parent server when this rule is hit, and if so after how much time?

If the connection remains open on the parent server this is a pointless task. Is there a better way to accomplish this (aside from rewriting the slow pages)?

Is there a way to trace the request through apache? Something like logging error_log in PHP.


Solution

  • It's pointless for the purpose of saving threads on the server.

    [P] means proxy, which means the entire time you wait for the 2nd server, a thread on the first server is tied up waiting to forward the response -- it remains the middleman.

    If the client can reach server B directly, just use the basic redirect ([R] flag) which will at least put the current connection into keepalive state.