Hej Jorge, I am so sorry, I forgot to include that I have already defined the Proxy URL as https://example.com (No port number, and with HTTPS)
I have noticed that the Demo Requests work with the proxy url, and have dug a bit into the code: https://github.com/geoserver/geoserver/blob/883865f96d60ad7023e42364966714cfcd720ef1/src/web/demo/src/main/java/org/geoserver/web/demo/DemoRequestsPage.java#L157-L175 In this snippet, I can see that the code tests if the proxyBaseUrl is set either in GeoServerExtensions or in the settings, and only uses the request's baseURL if no proxy URL is set. In the OpenLayers Preview, it jumps directly to using the request's baseURL and does not consider if the proxy base URL is set. My first intuition is that the code from the DemoRequestsPage.java can be reused in the AbstractOpenLayersMapOutputFormat.java without side-effects, but I am not sure. ANDERS OLSEN Softwareudvikler Software Developer Vesterbrogade 138-140 | 1620 København V | [email protected]<mailto:[email protected]> | www.dof.dk<https://www.dof.dk> Fra: Jorge Gustavo Rocha <[email protected]> Organisation: Geomaster, Lda Dato: tirsdag den 12. marts 2019 kl. 13.42 Til: "[email protected]" <[email protected]> Emne: Re: [Geoserver-devel] Layer Preview - OpenLayers does not work with a SSL Reverse Proxy Hi Anders, Maybe you can do a simple fix by defining "Proxy based URL". Go to Settings → Global and set "Proxy based URL" to your domain, with or without the port. Test it. Regards, Jorge Gustavo Às 20:19 de 11/03/19, Anders Olsen escreveu: Hello! I am currently using GeoServer 2.15.0 through a Tomcat running on port 8080. To control which webapps are available on my various domains, I run a reverse proxy with Apache in front on port 80, using a normal ProxyPass & ProxyPassReverse I also have SSL setup, so in short, my setup is like this: https://example.com/geoserver -> http://example.com:8080/geoserver (I have substituted my real domain with an example) I want to test my newest layer, so I go into Layer Preview -> OpenLayers and it opens a URL like this: https://example.com/geoserver/dof/wms?service=WMS&version=1.1.0&request=GetMap&layers=dof%3AREGIONER&bbox=441548.9689738757%2C6049494.406376901%2C893480.0854518213%2C6402159.588024116&width=768&height=599&srs=EPSG%3A23032&format=application/openlayers However, this returns a white map! In the console, I see the following (I've translated it but hopefully it still makes sense): Blocked mixed content "http://example.com/geoserver/openlayers3/ol.css"<http://example.com/geoserver/openlayers3/ol.css> Blocked mixed content "http://example.com/geoserver/openlayers3/ol.js"<http://example.com/geoserver/openlayers3/ol.js> Blocked mixed content "http://example.com/geoserver/openlayers3/ol.css"<http://example.com/geoserver/openlayers3/ol.css> Blocked mixed content "http://example.com/geoserver/openlayers3/ol.js"<http://example.com/geoserver/openlayers3/ol.js> Loading failed for <script> with source "http://example.com/geoserver/openlayers3/ol.js"<http://example.com/geoserver/openlayers3/ol.js> ReferenceError: ol is not defined When I look at the source, I see that the wrong URL is used: <link rel="stylesheet" href="http://example.com:80/geoserver/openlayers3/ol.css"<http://example.com:80/geoserver/openlayers3/ol.css> type="text/css"> <script src="http://example.com:80/geoserver/openlayers3/ol.js"<http://example.com:80/geoserver/openlayers3/ol.js> type="text/javascript"></script> From what I can find in the code, org/geoserver/wms/map/AbstractOpenLayersMapOutputFormat.java:134 uses this as the baseUrl for the template: String baseUrl = ResponseUtils.buildURL(request.getBaseUrl(), "/", null, URLType.RESOURCE); The code is a bit too complex for me to create a fix, since I am not sure what ramifications my changes might have, but my guess would be that for the AbstractOpenLayersMapOutputFormat, either the base proxy url from the GeoServer settings or all X-Forwarded type of headers should be considered. Med venlig hilsen / With regards ANDERS OLSEN Software Developer BirdLife Denmark _______________________________________________ Geoserver-devel mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/geoserver-devel -- [Logo] Geomaster, LDA VENHA DESCOBRIR O CAMINHO DO OPEN SOURCE CONNOSCO Avenida Barros e Soares N.º 423, 4715-214 Braga VAT/NIF 510 906 109 Phone +351 253 680 323 Site geomaster.pt<http://geomaster.pt> GPS 41.53322, -8.41929 ________________________________ Jorge Gustavo Rocha CTO Mobile +351 910 333 888 Email [email protected]<mailto:[email protected]>
_______________________________________________ Geoserver-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-devel
