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.

In GeoServer, when I go to Layer Preview/OpenLayers, I get a web page, but the HTML points to localhost:8080 (instead of a relative path) for its WMS requests, so I can only see previews on the server itself.

Is there a way to change the template or format of the OpenLayers preview, preferably without having to recompile anything?

Update

It looks like my question is being misunderstood, so I was probably not clear. Sorry about that.

Jetty indeed runs at port 8080, but that's fine.

The problem is that only with showing the OpenLayers preview. Its JavaScript points to the WMS service at localhost:8080, even when you access the page from another machine.

I can't find any template on disk (I expected to find some .xslt or .ftl somewhere).

Update 2

I've reported this in the GeoServer issue tracker: https://jira.codehaus.org/browse/GEOS-4930

share|improve this question
    
We recently configured our OpenGeo Community Suite to use port 8081 at install time. That was successful, but I am not sure how to change an installed instance. –  jvangeld Jan 6 '12 at 19:52
    
What version of Geoserver are you using? –  R.K. Jan 8 '12 at 13:40
    
Hi, i'm running 2.1.2. I'm about to install 2.1.3 on a testserver to see if it breaks anything that we do. –  Wouter van Nifterick Jan 9 '12 at 3:14

2 Answers 2

The default GeoServer app engine / server is Jetty. In case you have not switched to the more powerful Tomcat, there is the procedure to change the port :

  • Shutdown Jetty server running $GEOSERVER/bin/shutdown.sh or $GEOSERVER/bin/shutdown.bat
  • Open file $GEOSERVER/etc/jetty.xml
  • Search line 8080 and change the default port.
  • Start Jetty

Here is my source for this procedure.

Edit : My answer was out of topic, so here is another one.

The preview function of GeoServer, using OpenLayers, is just a preview function, not a full featured OpenLayers application.

If you want to use the preview from distant client machines, you must log into the GeoServer administration and then go to preview. Just replace "locahost" with the IP address or DNS name of the server machine. If that don't work, your GeoServer installation could be broken, please provide details on the installation context (OS, versions).

If you want to consume your webservices from distant client machines, you should build an OpenLayers application with WMS/WFS layers connected to your GeoServer data feeds. See the examples on the OpenLayers doc.

share|improve this answer
    
Thanks, that's useful information if I ever want to change the port. If I'd change the port, OpenLayers previews will still point to localhost though.. –  Wouter van Nifterick Jan 8 '12 at 7:46
    
Oups yes sorry, i overlooked that ! I'll try to answer more appropriately :) –  Laurent Jégou Jan 8 '12 at 8:27
    
The layers are integrated in several (remote) systems (delphi desktop applications and web pages with openlayers). That all works fine. Really, i only want to modify the openlayers preview template so that it doesn't link to localhost. In my case, using / as a root instead of a hostname would be fine. I'm starting to realise that the "template" is compiled into geoserver, and there is no way to override this. Bummer. I'm a bit amazed that nobody seems to be bothered by having to modify the preview html in order to make it work, or having to run a browser on the webserver. –  Wouter van Nifterick Jan 9 '12 at 3:07

It is a preview - it is only supposed to show layers on your machine.

If you want to display layers from other servers then you need to copy the preview HTML to another file (pop it in data/www/ if you want to use the GeoServer jetty) then edit the layer variable in the file to point to the other server. See Lesson 8 of my web mapping course for more details.

Note that with out a proxy getFeatureInfo requests will not work.

share|improve this answer
    
Indeed, "preview" is supposed to show a layer. The problem is that it doesn't, because it points to localhost, and from the point of view of "my" machine, that's not where GeoServer runs. Btw, the production system accesses GeoServer via a proxy; all that is working. I understand that I can fix the broken HTML if I make a copy, but I'm looking for a way to change the template. I add layers all the time, so it's a big pita that I can only easily inspect new layers via a preview when I connect from a browser on the server. I don't always have that type of access to the server. –  Wouter van Nifterick Jan 8 '12 at 22:13
    
sorry I misunderstood your question. Simply go to the global settings page and set the Proxy Base URL to point to a real machine –  iant Jan 9 '12 at 9:07
    
The Proxy Base URL points to the real machine. It has an address that is reachable from "outside". If the preview would use this address it would work. However, it insists on using localhost:8080. –  Wouter van Nifterick Jan 11 '12 at 19:05
    
I'm pretty sure that's all I did on my machine (see ian01.geog.psu.edu/geoserver/… for an example) check ian01.geog.psu.edu/geoserver_docs/index.htmlfor set up details. –  iant Jan 12 '12 at 9:33
    
Hey, it's nice to see that it -should- be possible. Thanks for posting that link! Your previews work indeed. I do have the Proxy Base URL set up though, but it's not working. One of the lead developers of Geoserver confirmed that the Proxy Base URL is not used. But what is used instead then? I'll download the sourcecode to try to figure out how the URL's are generated. Frustrating... :) –  Wouter van Nifterick Jan 13 '12 at 4:50

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.