I have a QGIS server (using https://github.com/camptocamp/docker-qgis-server) project to serve some data using OGC API – Features.
It's working properly at a new /wfs3/
endpoint in the nginx configuration of an existing web application.
That means I can access the QGIS server home page here:
https://my-project-base-url.ch/wfs3/
But if I click the "Feature collections" link for example, which should go to:
https://my-project-base-url.ch/wfs3/collections
it actually goes to a wrong URL, having the docker network alias of the webapp as the base URL:
http://webappproject-qgisserver/wfs3/collections
with my web browser telling me:
Hmm. We’re having trouble finding that site.
We can’t connect to the server at webappproject-qgisserver.
I was thinking the "Advertised URL"* under the "WFS" part in the "QGIS server" properties (at the QGIS project level, not the layer properties level) was there to precise the base URL of the application, but I've tried without success. The problem persists.
* Note: this Advertised URL goes to this tag in the .qgs file:
<WFSUrl type="QString">https://my-project-base-url.ch/</WFSUrl>
Because if I manually enter the correct URL, namely https://my-project-base-url.ch/wfs3/collections, the web browser actually goes to the correct page, listing all the collections.
I was thinking there could be an environment variable to play with, but I cannot find any "url" related variable there: https://docs.qgis.org/3.22/en/docs/server_manual/config.html?highlight=environment#environment-variables
Is there something I can do to make all the links properly work?
EDIT:
nginx.conf (only the location block of the /wfs3/
endpoint, the whole file is much more complex):
location /wfs3/ {
proxy_redirect off;
proxy_pass http://webappproject-qgisserver:80;
}
docker-compose.yml:
version: '3.8'
networks:
www:
external:
name: www
services:
qgisserver:
image: "camptocamp/qgis-server:3.22"
ports:
- "xxxx:80"
networks:
www:
aliases:
- webappproject-qgisserver
volumes:
- ./qgis_projects:/etc/qgisserver
Best Answer
I was told that I was missing this
proxy_set_header
line in the/wfs3/
nginx location block:Then every link is working correctly.