That is correct.  Some details from my server recipes in case it helps.
Note that I am using reverse proxy to apache but should be similar
for Nginx
Proxy

To support the reverse proxy setup we need to add this as per documentation
<https://docs.geoserver.org/latest/en/user/security/webadmin/csrf.html>

nano /opt/tomcat/latest/webapps/geoserver/WEB-INF/web.xmlADD this:

  <!--Added to support reverse proxy-->  <context-param>
<param-name>GEOSERVER_CSRF_WHITELIST</param-name>
<param-value>subdomain.domain.com</param-value>  </context-param>

systemctl restart tomcat

Enable CORES

You will need to enable CORES before you can administer GeoServer.

This is required for access to WMS from GeoServer to the webservers. It is
also required for GeoServer GUI such as redirecting to the suer page.
Without this you will not be able to reset the default user password for
example.

nano /opt/tomcat/latest/conf/web.xml

add to bottom of config file inside last bracket.

     <filter>         <filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
     <init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>         </init-param>     </filter>
<filter-mapping>         <filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>     </filter-mapping>

And then not sure for Nginx  but for apache2 you you of course need the
proxy module enabled and the proxy setting in the apahce2 site.conf

*  reverse proxy  *

Then set up the reverse proxy for tomcat. *before SSL *(if you already
enabled SSL you might have to edit your post ssl cnfig file.

cd /etc/apache2/sites-available/cp 000-default.conf mySite.confnano
mySite.confa2dissite 000-default.confa2ensite mySite.confsystemctl
reload apache2reboot -h now

(Note the reboot is important here. I am not sure why but it never
works for me until I reboot)

Content of config file

<VirtualHost *:80>        ServerAdmin xx@xx        ServerName
xx.xx.com        ServerAlias www.xx.xx.com        DocumentRoot
/var/www/xx/html        ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined        ProxyRequests
Off        <Proxy *>          Order deny,allow          Allow from all
       </Proxy>        ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/        <Location />
Order allow,deny          Allow from all
</Location></VirtualHost>


It's fun when it works.

Vera


On Sun, May 16, 2021 at 3:49 AM Ian Turton <ijtur...@gmail.com> wrote:

> You need to set your proxy in the global settings page -
> https://docs.geoserver.org/stable/en/user/configuration/globalsettings.html#proxy-base-url
>
> Ian
>
> On Sun, 16 May 2021 at 06:36, Brian Holmes <bhcontinentaldr...@gmail.com>
> wrote:
>
>> Hello everyone -
>>
>> I have installed Geoserver 2.19.0 on an Ubuntu 20.04 server, under Tomcat
>> with Nginx as reverse proxy. I can log in to the web interface using the
>> server IP  Number, something like 123.45.67.89:8080/geoserver. This
>> gives me full access. It also appears to work when I use the dedicated URL
>> I have set up, so the URL is working properly (I also pinged it). However,
>> after entering the default name and password in Geoserver, the address in
>> my browser bar reverts from the URL to
>> http://127.0.0.1:8080/geoserver/web - and it connects to localhost on my
>> local machine, where I also have geoserver running! Of course I have
>> emptied the browser cache and I've searched all over GIS Stack Exchange but
>> still can't find the solution. My tomcat.conf (which replaces nginx default
>> if I've understood correctly) looks like this:
>>
>> server {
>>   listen 80;
>>
>>   server_name    geo.timetochange.today;
>>   access_log /var/log/nginx/tomcat-access.log;
>>   error_log /var/log/nginx/tomcat-error.log;
>>
>>   location / {
>>         proxy_set_header X-Forwarded-Host $host;
>>         proxy_set_header X-Forwarded-Server $host;
>>         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>         proxy_pass http://127.0.0.1:8080/;
>>   }
>> }
>>
>> I would be totally grateful for any help with this issue.
>>
>> all the best, Brian Holmes
>> _______________________________________________
>> Geoserver-users mailing list
>>
>> Please make sure you read the following two resources before posting to
>> this list:
>> - Earning your support instead of buying it, but Ian Turton:
>> http://www.ianturton.com/talks/foss4g.html#/
>> - The GeoServer user list posting guidelines:
>> http://geoserver.org/comm/userlist-guidelines.html
>>
>> If you want to request a feature or an improvement, also see this:
>> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>>
>>
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>
>
> --
> Ian Turton
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to