[GIS] GeoServer behind a reverse proxy with CORS problems using buttons

corsgeoserverjetty

I've set up a simple GeoServer on a Ubuntu server, behind an NGINX reverse proxy. The proxy is at map.mydomain.com and passes incoming port 80 requests on a subdomain to another internal port.

I can access the web interface all no problems, log in etc. But whenever I try to use most buttons (save/apply/etc) I get a CORS error: "Origin does not correspond to request".

This is a snapshot of the request on clicking one of these buttons:
enter image description here

I have followed the below to enable CORS, but no luck. This is the default GeoServer 2.18.0 install, so it is using Jetty.
Enabling CORS in GeoServer (jetty)?

All I can figure is somewhere, some bits of Jetty may be expecting 127.0.0.1 rather than maps.ourdomain.com but for the life of me I can't figure out how or why it's only on button clicks!

proxy config:

    proxy_pass http://127.0.0.1:3201/$1$is_args$args;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Best Answer