Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using Apache (port 80) and Geoserver (port 8080) on Windows 7. I guess I need to set up a proxy if I want to use WFS, since they're on different ports. My kind of silly question is, can I avoid it? If I re-set my website on Geoserver's www file, is everything going to work fine? Does Geoserver share the same characteristics with Apache?

If Geoserver's www file is a bad idea can you please help me set up a proxy? I never done it before, so if you have a link with an analytical tutorial, it would be great...

Thanks,

share|improve this question
    
Can you provide a little more information? Is this an already-in-production site, or can you change URLs without much trouble? Are you familiar with Apache configuration? –  BradHards Jan 19 '13 at 23:55
    
The whole system is on my laptop, still localhosts.I'm not so experienced with Apache config... –  slevin Jan 20 '13 at 0:00
add comment

2 Answers 2

I assume that your Apache is on port 80 and your Geoserver is on the same machine on port 8080.

I would suggest that you set up a reverse proxy on your Apache server. On my server I have set up Apache to resolve http://example.com/geoserver to http://example.com:8080/

That way I can just use the wms link as http://example.com/geoserver/wms & I don't need to use a proxy.cgi file.

You can see this Post on how to set Apache to route to another port using Virtual Hosts.

share|improve this answer
    
@ Devdatta I added to the Apache's httpd.conf file these lines LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so and at the end these ProxyPass /geoserver localhost:8080/geoserver ProxyPassReverse /geoserver localhost:8080/geoserver and I can now acceess geoserver's admin console through 80 port (using localhost/geoserver/web instead of localhost:8080/geoserver/web). I guess proxy is ok now? –  slevin Jan 20 '13 at 19:41
    
@ Devdatta What about this line? OpenLayers.ProxyHost = '/cgi-bin/proxy.cgi?url='; Says I have to change the URL to point to my ProxyHost...But I did not add a proxy.cgi file at all... –  slevin Jan 20 '13 at 19:53
    
You don't need that line at all. SInce now your geoserver is on the same domain as your appliation (i.e you are accessing your wms service as domain/geoserver/wms) you will not run into the crossdomain limitation –  Devdatta Tengshe Jan 21 '13 at 3:07
    
Thanks guys, problem solved –  slevin Jan 21 '13 at 17:29
    
@slevin Please consider marking the answer that helped you most as Accepted. –  Devdatta Tengshe Jan 22 '13 at 3:00
add comment

Almost any tool that you want to use with Apache or Geoserver will accept a port number as part of the URL. So for something like openlayers, a simple WFS example is shown at http://openlayers.org/dev/examples/wfs-filter.html

If you look at the source of that, you'll see a part that looks like:

            protocol: new OpenLayers.Protocol.WFS({
                url:  "http://demo.opengeo.org/geoserver/wfs",
                featureType: "tasmania_roads",
                featureNS: "http://www.openplans.org/topp"
            }),

For you, that is going to be something like:

            protocol: new OpenLayers.Protocol.WFS({
                url:  "http://localhost:8080/geoserver/wfs",
                featureType: "tasmania_roads",
                featureNS: "http://www.openplans.org/topp"
            }),

(where the bit after localhost:8080 depends on how you set up your geoserver, but should be fine if http://localhost:8080/geoserver brings up the admin console, as shown in http://docs.geoserver.org/stable/en/user/installation/windows/installer.html)

With that information, you should be able to avoid setting up a reverse proxy on Apache.

share|improve this answer
    
@ Brad What do you mean by "where the bit after localhost:8080 depends on how you set up your geoserver"? I thought that the url that I set was OK. And I need a proxy anyway because of the different ports. That's interesting (and I'm a rookie as you can see). Pls explain –  slevin Jan 20 '13 at 0:19
    
Sorry: its hard for me to understand how you set up your GeoServer instance, and I don't understand what you do and don't know. GeoServer is very flexible, so there are some possibilities here. I'll expand the words above. –  BradHards Jan 20 '13 at 0:24
    
No, it's my fault, I am sorry, let me rephrase. How can I check if the url I gave in WFS protocol, is valid? –  slevin Jan 20 '13 at 0:46
    
You can do the procedure I put above (seeing if the management console comes up). To check WFS in particular, you can add "?request=getcapabilities" to the end of the URL, and check if that works in a browser or with curl or some other command line tool, (returning an XML file). So if localhost:8080/geoserver/wfs?request=getcapabilities works, it is the right URL. –  BradHards Jan 20 '13 at 0:51
    
So, localhost:8080/geoserver actually does bring the admin console, but when I do a getcapabilities request, I get this on Chrome's console XMLHttpRequest cannot load localhost:8080/geoserver/wfs?request=getcapabilities. Origin localhost is not allowed by Access-Control-Allow-Origin. –  slevin Jan 20 '13 at 1:05
show 1 more 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.