4

I'm running Geoserver over HTTPS and when I preview a layer with openlayers3 format the page throws an error.

The error point that some resources

i.e. http://mydomain.com/geoserver/openlayers3/ol.js

are blocked because are requested over HTTP.

enter image description here


I tried to change it manually but I can't find the file.

Is there some configuration file I need to change so that the page request the content over HTTPS?

8
  • 1
    Are you saying you are using OpenLayers as an output format from a GeoServer service, or have an OpenLayers client already, and are trying to consume an HTTPS service from GeoServer?
    – nmtoken
    Commented May 11, 2018 at 12:18
  • Sorry if It was unclear. Is the own Geoserver's LayerPreview Page (selecting openlayers from the dropdown output format) which request those resources over HTTP. Using WMS or other services in my own openlayers client works great. It's just the LayerPreview Page. Commented May 11, 2018 at 13:11
  • 2
    Layer preview is really only designed to work from localhost. Feel free to open a PR with a fix though
    – Ian Turton
    Commented May 13, 2018 at 15:42
  • 2
    @IanTurton The Geoserver team should really fix this! The protocol part of the request url should not default to http but rather use whatever protocol the preview page is accessed on.
    – Ries
    Commented Sep 27, 2018 at 8:50
  • 1
    Seems that in my case it may be because HAProxy is converting the https request into an http request. Not sure why Geoserver is using the https host name but http scheme though. I have opened an issue here: osgeo-org.atlassian.net/browse/GEOS-8952
    – Ries
    Commented Oct 9, 2018 at 12:22

1 Answer 1

5

Setting Proxy Base URL in global settings worked for me.

http://docs.geoserver.org/stable/en/user/configuration/globalsettings.html

In your example, the Proxy Base URL you should enter is:

https://mydomain.com/geoserver/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.