title: Reverse proxy mode Apache intercept or trap 302 responses from backend server and redirect internally without sending 302 response back to client
body: <p>Does anyone knows how to tell Apache, in reverse proxy mode, to intercept or trap 302 (or 30x) responses from backend server and redirect internally without sending 30x response back to client?
  Ultimately, the backend server the response is redirected to would not be accessible from the outside (or not listed in Apache conf).</p>
  
  <hr>
  
  <p>My situation:<br/>
  I have web_server_A  and web_server_B listening on port 6666 and 7777. These ports are not accessible from outside, but are accessible from the inside.
  <br/>
  I can eventually change the behavior of web_server_A, but not the one of web_server_B.
  <br/>
  Apache is listening on ports 80/443, accessible from the outside and is acting as a reverse proxy sending requests addressed to web_server_{A,B}.example.com to web_server_{A,B}</p>
  
  <p>The client asks Apache for web_server_A.example.com/foo. Apache proxies the request to web_server_A which makes some stuff and then sends back to Apache a HTTP/302 response pointing on web_server_B.example.com/bar/secret_token. Apache sends back the 302 response to the client which then sends Apache an HTTP request for web_server_B.example.com/bar/secret_token. Apache proxies the request to web_server_B, which replies something (usually it sends back some big file).</p>
  
  <hr>
  
  <p>My problem:<br/>
  I don't want the client to know about the url web_server_B.example.com/bar/secret_token, and ultimately I don't want web_server_B to be accessible from outside.</p>
  
  <p>web_server_A could make the request to web_server_B and then send back the answer from web_server_B without issuing a 302 reply. But, the answer from web_server_B might take some time to come, might be quite big, and web_server_A should not spend too much time on any request (it has no ability for handling big files).</p>
  
  <hr>
  
  <p>So I thought about a "302 trapper" feature that would be nice if existing, but so far haven't fund anything on the web on how to do that. Any idea?</p>