Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to setup a reverse proxy for my website. Basically, I have an external site example.com/site/folder that needs to reverse proxy to some internal VMs. Here's a little background

  • All machines run Server 2008 (Standard)
  • 1 machine (the reverse proxy server.example.com) has an external IP
  • Several other internal VMs run IIS 7 and Server 2008

I've got the reverse proxy working and I can successfully send requests matching example.com/site/folder/ over to site-internal.example.com/folder/

However I'm having problems with 301 redirects that are returned by the internal VMs. When the user goes to http://example.com/site/folder without the trailing slash, the internal VM shoots back a redirect to go to folder/. This causes a 404 at the host machine level because example.com/folder/ does not exist.

On server.example.com I added the pre-configured URL rewrite rule to append the trailing slash for me --- but when I enable this rule it seems to be too broad. Although it fixes the 404 errors and forces the client from folder to folder/ before it is proxied, the rule also adds a / to regular requests (ie. example.com/site/images/test.jpg becomes example.com/site/images/test.jpg/) This causes a 404 at the VM level because there is no file that matchines test.jpg/

Any thoughts on how to get around this? I'd prefer to make all changes at the host machine level (rather than the VMs) -- but if I absolutely have to change the VMs I can do that.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I'm not sure what you're using for the reverse-proxy and whether it's just URL Rewrite by itself, but ARR is the way to do this. I've put together some videos on how to setup ARR as a reverse-proxy, and some tricks to consider. Check it out starting with week 31 here.

ARR will proxy all requests including subpages and subfolders. Then you can use URL Rewrite on the public (ARR) server to remove trailing slashes and such for search engine purposes.

share|improve this answer
    
Thanks - I was actually using that - I just needed to add a rule on the front end to stick a / on the end if it's not file. That was a little hard to detect, but I just check if the URL (after the domain) contains a . or a ? -- thanks! –  debracey Sep 14 '11 at 2:24
    
That works. Another option is to add the redirect on the web servers where you can check for the existence of the file. –  Scott Forsyth - MVP Sep 14 '11 at 14:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.