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

Currently, we have an IIS server as our primary web server. We are implementing an Apache server in its place, but still need to have the IIS server accessible. Typically, this is a simple thing, because Apache2 can proxy a subdomain to this server.

Our problem, however, is this: we are using dotnetCharting on the IIS server, and the licensing is tied to the domain name. In order to get dotnetCharting to work, another license will have to be purchased.

My question is, can Apache2 proxy a subdirectory? For example, can 'www.example.com/subdir' point to the IIS server? It seems like it shouldn't be impossible, but I can't seem to find a solution for this.

Any help would be super.

Thanks! -Jer

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Sure. But be careful; a lot of web applications aren't designed well for having their URL path change. Is the application used in a sub-directory currently?

# You'll probably want this to maintain the host mapping in IIS
ProxyPreserveHost On
# Swap in the IP address or internal host name of your IIS server:
ProxyPass /subdir/ http://192.0.2.100/subdir/

Or, if you're altering the URL path, keeping in mind that a lot of applications will have problems with this, due to absolute paths for resources (CSS, javascript, images):

ProxyPass /subdir/ http://192.0.2.100/
ProxyPassReverse /subdir/ http://192.0.2.100/
share|improve this answer
    
Perfect! That did the trick in my test environment. Right now, internally, you can enter the server's IP address and use our internal proxy to get to the server, and everything (except dotnetcharting) works perfectly, so I don't expect the application to fail when we proxy it with this method. Much appreciated! –  SuperJer Sep 17 '12 at 16:40

Sure.

  1. Enable mod_proxy mod_proxy_http
  2. set the following instruction in your Apache VHost

    ProxyPass /subdir http://iis.server/.../
    ProxyPassReverse /subdir http://iis.server/.../
    

Note the final "/" is mandatory.

For moreinformation: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

share|improve this answer

the final slash on the end is NOT mandatory. I had it setup like this

ProxyPass /dir http://exmpale.com/dir/ 

ProxyPassReverse /dir http://exmpale.com/dir/ 

and the the top level worked but eveyrything in subdirs beneath the main one did not.

I changed it to this and everything worked.

Thanks for the misinformation!!!

ProxyPass /dir http://exmpale.com/dir

ProxyPassReverse /dir http://exmpale.com/dir
share|improve this answer

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.