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 building a mapping application based on OpenLayers that uses GeoServer to serve up mapping data. The problem I'm having is that besides the map images I'm requesting through WMS, I'm using jQuery AJAX to get information from GeoServer. As GeoServer is running on a different port, my requests are being blocked due to cross-site scripting security policies in JavaScript.

As a Java application, GeoServer runs on Apache on port 8080, while my IIS instance is running on port 80. Instead of building a proxy, I've decided to use URL Rewriting in IIS7 to fix this problem. I'm following this guide, but it's still not working. Here are my URL Rewrite rule settings:

  • Matches URL: (.*)
  • Condition: {HTTP_URL} matching /geoserver
  • Action: rewrite to http://localhost:8080/{R:1}, appending query string

When I request http://localhost/geoserver/wms?QUERY_LAYERS=SanDiego:FWSA_sandiego&LAYERS=SanDiego:FWSA_sandiego&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=20&REQUEST=GetFeatureInfo&EXCEPTIONS=application/vnd.ogc.se_xml&BBOX=-13009123.590156,3862057.2905992,-13006066.109025,3865114.7717302&INFO_FORMAT=text/html&x=20&y=20&width=40&height=40&srs=EPSG:900913, however, all I get is a 404, although the same request on port 8080 returns the proper result.

What am I doing wrong? Thanks in advance.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

For the condition, try {URL} instead of {HTTP_URL}, and for the action make sure that it's a redirect rather than a rewrite.

share|improve this answer
    
I've switched to {URL} but I'm not looking for redirection, as that would make all my requests to that port 80 URL be transformed into port 8080 requests, which leads to my requests being blocked due to cross-site scripting security policies in JavaScript. –  Maxim Zaslavsky Dec 25 '10 at 6:51
1  
Try out Application Request Routing (ARR). iis.net/download/ApplicationRequestRouting. That adds the reverse proxy to URL Rewrite so it will front the URL while processing a different site on the back end. –  Scott Forsyth - MVP Dec 26 '10 at 19:01
add comment

Is the same rule picking up the request for 8080 and trying to rewrite it ad infinitum? Though I suppose a timeout or a querystring length error would be the expected outcome if it were, rather than a 404.

Are you using Failed Request Tracing? Using Fiddler? Tracing http.sys?

share|improve this answer
    
No, I don't think it's picking up :8080 requests, but I'll try it out and report back. I'm using Fiddler, but it's not telling me anything about what's going on inside IIS. As for Failed Request Tracing, I've enabled it but the log directory is empty. How do you trace http.sys? Thanks! –  Maxim Zaslavsky Dec 25 '10 at 20:24
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.