简体   繁体   中英

IIS 8.5 Proxy rewrite failing

I'm new to setting up proxy servers. On our actual web server. We have our website and within IIS this sits under wwwroot. I then have 2 other directories outside wwwroot, one with images and one with documents. Before I introduced the proxy the main site had virtual directories to the other 2 areas and all was ok. Moving to a more complex setup I have removed the virtual directories as these need to be re-directed via the proxy. So, basically any address for an image or document from the main site needs to redirect via the proxy to either the images or document area.

I've created 2 more websites in IIS one for documents and one for images and I've set the IP for these to be the same as the main site including the same port. Now moving to the proxy. I've created server farms for all the sites calling them the same name here (dns) as the names on the webserver. This has created default ARR URL Rewrite rules for each server in the farm. I wrote an inbound rule at the Proxy Server level that should redirect the images and using the in-built test showed that I'd put the test together correctly. However, placing it here or on an outbound rule made no difference.

I installed the IIS Trace facility on the proxy and noticed that the test wasn't being hit after looking at the trace logs. I moved my rule to the url rewrite inbound against the default site as opposed to the server. Now in the trace on step 4 I can correctly see that the old url has changed to my newURL and the NewUrl is my expected url, Great!. however, by the time the Trace reaches step 40, it is taking my new correct url as input and removing the domain name for the new url at this step, thus effectively putting the address back to the original. On the inbound rule that made the initial change I have Stop processing of subsequent rules checked.

These are the steps I have done for images and they are finally coming through.

  1. on the web server all my sites have the same IP and port number, only the hostnames are different.
  2. on my local client machine for now in my hosts file I point the main site to the ip of the proxy, but the other sites that I want to redirect to I point their ip to the actual webserver.
  3. in the server the server farm has just 1 ARR entry that is the main site. Leave this as the default, but uncheck the stop processing flag. Create a new inbound URL ReWrite rule for the first redirect. Make the action type a Redirect (not a rewrite this is important.)
  4. On the proxy under the default website, create binding entries for each hostname setting ports the same with ip address set to * then additionally create a blank hostname of the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM