title: Rerouting HTTP request from PHP back to Apache
body: <p>We are given the task to check URLs for integrity by the parameters on an apache reverse proxy. One of them is a hash that was calculated from 3 others. If the URL seems intact the reverse proxy functionality should kick in. Our problem is that <strong>we don't know how to reroute the request from php after checking back to the apache so it would continue/restart processing it.</strong></p>
  
  <p>We tried to start a new request with file_get_contents() but that doesn't handle the redirect well and waits for a timeout. </p>
  
  <p>It would be better not to reimplement a reverse proxy in php but let the apache do this.
  Our hash checking looks like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
      $ss=$_SERVER['QUERY_STRING'];
      parse_str($ss,$qa);
      if (array_key_exists('hash', $qa)&amp;&amp;array_key_exists('id1', $qa)&amp;&amp;array_key_exists('id2', $qa)&amp;&amp;array_key_exists('id3', $qa)) {
          $hstr=$qa['id1'].$qa['id2'].$qa['id3'];
          $hash=hash_hmac('md5',$hstr, '@#$%^&amp;**&amp;^@ key !@^&amp;*&amp;T^%$');
          if ($qa['hash']==$hash) {
  </code></pre>
  
  <p>and here we should do something so php would pass the request back to apache process queue.</p>
  
  <p>Thanks in advance!</p>