Q:

'Masking' external url links using RewriteProxy derictive

I have a simple rewrite rule that writes to an external domain using the Helicon Isapi_Rewrite 3 RewriteProxy derictive.
Example: RewriteProxy blog http://blog.com
However, links on the external site are not masked by the proxy as I would have expected them to be. They are still pointing to http://blog.com/link1 rather than http://mysite/blog/link1.
Could anyone point me in the right direction of a solution to this?
Thanks

A:

This discussion on the Helicon Tech forums addresses the same issue.
http://www.helicontech.com/forum/8460-rewrite_proxy_to_2d_machine.html
The first example provides code for ISAPI Rewrite 2, but the thread includes ISAPI Rewrite 3 syntax further down the page. Here's an adaptation of their version 3 code for your example.
RewriteEngine on
RewriteBase /
RewriteRule ^blog$ http://mysite/blog/ [NC,R=301]
RewriteProxy ^/blog(/.*)?$ http\://blog.com$1 [NC,U]

(This is untested because I am running ISAPI Rewrite 2.) Note that I hit some snags when attempting to reverse proxy another site under my "main" domain. You might discover these issues as well.
1) Non-Relative Links
Unless the application has been coded from the ground up to assume reverse proxying, I found it likely to break. A bare-bones HTML page using all relative links like  will work. However, serving HTML through a reverse proxy that contains this code  will map to http://mysite/page_from_the_root.html. ISAPI Rewrite does not know to intercept that request, but it would proxy content if the user's browser hit http://mysite/blog/page_from_the_root.html
2) Cookies
Blog.com might write cookies from the blog.com domain. A page served through the MySite domain might not be able to access these cookies, depending on the user's browser settings.
3) JavaScript and AJAX
4) SSL Certificates

