Jump to content

[SOLVED] Rewrite all proxy requests


silmarilwest

Recommended Posts

Hi there,

I am trying to create a mod_rewrite rule that will take all proxy requests to my non proxy server and rewrite them to display my custom error page. Here is what I have so far based on my limited knowledge (located in httpd.conf, Apache 2.2 on Windows XP 32bit):

 

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_PROXY_CONNECTION} !^$
RewriteRule ^/$ http://myserver/subdir/error.html [R]
</IfModule>

 

It seems to work for base website addresses, for example if I try to proxy cnn.com the address is changed to myserver/subdir/error.html, but when there is a subdirectory or file specified (cnn.com/index.html or cnn.com/subdir/subsubdir/) the rewrite rule not longer seems to work. I have limited understanding of what I wrote and it clearly is not working as I intended. Is there a way to rewrite all proxy requests to a single page? Thanks  :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.