0

I have GeoServer 2.18.2 hosted on tomcat 9.

http://xx.xx.xx.xx:8080/geoserver/web

With the IP it is working perfectly fine.

To use it within OpenLayers I was needed it behind SSL. So through proxypass I have hosted it in apache2 to give it a domain name. Below are the configurations

<VirtualHost *:80>
    ServerName geoserver.example.com
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy /geoserver>
        Order deny,allow 
        Allow from all 
    </Proxy>
    ProxyPass /geoserver http://127.0.0.1:8080/geoserver
    ProxyPassReverse /geoserver http://127.0.0.1:8080/geoserver
RewriteEngine on
RewriteCond %{SERVER_NAME} =geoserver.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

https://geoserver.example.com/geoserver/web/ Now I can access the layers in OpenLayers and login into admin successfully but when I click on navigation and use search and save other settings it gives me 400 Bad Request Error.

Apparently, it seems like there is an issue in proxy pass configurations because when I use it along with port 8080 it works prefectly. But I needed this way along with SSL https://geoserver.example.com/geoserver/web/

enter image description here

Vince
  • 20,017
  • 15
  • 45
  • 64
Awais Khan
  • 11
  • 1
  • Did you set up the proxy in global settings? – Ian Turton Mar 01 '21 at 19:03
  • Do you mean proxy base URL? If so Yes I tried that one too and gave this URL https://geoserver.example.com/ but no success. – Awais Khan Mar 02 '21 at 07:10
  • https://docs.geoserver.org/latest/en/user/security/webadmin/csrf.html – Ian Turton Mar 02 '21 at 08:42
  • @IanTurton I have been trying these but no success. I don't know I did it correctly or not. Can you please tell me should I use geoserver.example.com in my case or IP with the port? – Awais Khan Mar 02 '21 at 08:47
  • assuming that "geoserver.example.com" is your service's name then use that, also make sure you have https in the proxy base url – Ian Turton Mar 02 '21 at 08:50

0 Answers0