0

I'm trying to run geoserver in production but I have some issues.

System Configurations

WPS : operating system Debian 12
Geoserver : 2.25.0
Domain name on cloudfare
ssl certificate from certbot
Geoserver directory : /usr/share/geoserver

Issue 1

The web interface of geoserver is at domainname.com:8080/geoserver/web/

I want the port not to be shown in the url, the result should be like domainname.com/geoserver/web

Issue 2

When I go to my website the SSL certificate is good: I have https://domainname.com

But the web interface of geoserver is still in HTTP: http://domainname.com:8080/geoserver/web/

I want the web interface and everything that refers to geoserver resources to be in HTTPS.

Thanks for the help.

I've tried to make a proxy and reverse proxy in a virtual host but it's not working.

Here's my configuration

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName geoserver.domainname.com

        #ServerAdmin webmaster@localhost
        #DocumentRoot /var/www/html
        ProxyPass /geoserver  http://localhost:8080/geoserver
        ProxyPassReverse /geoserver  http://localhost:8080/geoserver

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =domainname.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [NE,R=301,L]
RewriteCond %{SERVER_NAME} =geoserver.domainname.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

1
  • Ports and Https are handled by Apache or nginx not GeoServer. Once you have fixed that you can set the proxy URL in the GeoServer global settings to make sure the gui and capabilities point to that end point.
    – Ian Turton
    Commented May 6 at 18:12

0