AjaxControlToolkit JavaScript is not pointing correctly on IIS7 running behind Apache mod_proxy

Posted by sohum on Server Fault See other posts from Server Fault or by sohum
Published on 2010-06-02T04:14:04Z Indexed on 2010/06/02 4:25 UTC
Read the original article Hit count: 538

So here's my setup. I've got a DynDNS account since I have a dynamic IP. I have Apache listening on port 80 and IIS7 on port 8080. I don't want users to have to enter in mydyndns.dyndns.com:8080 to get to IIS7, so I've added the following code to my Apache httpd.conf file to enable a proxy/reverse proxy:

<VirtualHost *:80>
    ProxyPass / http://localhost:8080/myASPSite/
    ProxyPassReverse / http://localhost:8080/myASPSite/
    ServerName myaspsite.mydomain.com
</VirtualHost>

I've got a CNAME record set up on my DNS so that myaspsite.mydomain.com redirects to mydyndns.dyndns.com.

When I type in myaspsite.mydomain.com into my browser, everything works beautifully... mostly. IIS7 serves up the ASPX pages and visitors to the site don't know any better.

A problem arises, however, when I add Ajax Control Toolkit controls into my ASPX website, because these generate JavaScript and apparently mod_proxy_html isn't geared to handle the JS URIs properly. Sure enough, when I open up the source of my ASPX page, it has script elements as follows:

<script src="/myASPSite/WebResource.axd?xyz" type="text/javascript"></script>
<script src="/myASPSite/ScriptResource.axd?xyz" type="text/javascript"></script>

Sure enough, these scripts are attempting to be resolved at http://myaspsite.mydomain.com/myASPSite/WebResource..., which through the proxy translates to localhost:8080/myASPSite/myASPSite/....

How can I solve this problem. The couple of websites I found suggested turning on ProxyHTMLExtended but when I tried doing that, the server did not start. I'm guessing I didn't know how to do it properly. Anyone has a handy couple of config lines that I can add to my Apache conf file to get this working as I need? I'm using Apache 2.2.11.

Thanks!

© Server Fault or respective owner

Related posts about iis7

Related posts about apache2