-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OGC API Features ignores "X-Qgis-Service-Url" header #53367
Comments
I think this is a won't fix: there is a substantial difference between the old style services (WMS, WFS etc.) and the new REST services (like OAPIF) which is that the base URL path is fixed in the old-style services (while the query string changes) while it changes in the new ones depending on the different endpoints of the collection items. Besides that your example does not conform the the specifications of the REST API: the base URL should not contain any query string, you should rewrite your path or use another mechanism to build an URL which contains the MAP information in the base path (like the landing page server plugin does). In any event there are other ways to set the base URL for the OAPIF service in a real life deployment (by using any URL rewrite or proxy headers X-Forwarded-Host in the web server configuration). |
@elpaso thanks for your explanation.
This is exactly my use case. My QGIS Server itself is not directly exposed to the user. The requests are proxied by a middleware. For WMS and WFS I can add the header I would like to accomplish the same with OAPIF. Do you know if this is possible with build-in features from QGIS Server? |
It may depend on your particular stack, but this works for me: $ REQUEST_URI='http://test_server.com:8080/wfs3/index.json' QGIS_PROJECT_FILE="$(pwd)/gh_53213.qgs" /usr/lib/cgi-bin/qgis_mapserv.fcgi
Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.
Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.
Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable.
"Loading native module /usr/lib/qgis/server/libdummy.so"
"Loading native module /usr/lib/qgis/server/liblandingpage.so"
"Loading native module /usr/lib/qgis/server/libwcs.so"
"Loading native module /usr/lib/qgis/server/libwfs.so"
"Loading native module /usr/lib/qgis/server/libwfs3.so"
"Loading native module /usr/lib/qgis/server/libwms.so"
"Loading native module /usr/lib/qgis/server/libwmts.so"
Content-Length: 688
Content-Type: application/json
Server: QGIS FCGI server - QGIS version 3.30.3-'s-Hertogenbosch
Status: 200 {"links":[{"href":"http://test_server.com:8080/wfs3.json","rel":"self","title":"Landing page as JSON","type":"application/json"},{"href":"http://test_server.com:8080/wfs3.html","rel":"alternate","title":"Landing page as HTML","type":"text/html"},{"href":"http://test_server.com:8080/wfs3/collections","rel":"data","title":"Feature collections","type":"application/json"},{"href":"http://test_server.com:8080/wfs3/conformance","rel":"conformance","title":"Conformance classes","type":"application/json"},{"href":"http://test_server.com:8080/wfs3/api","rel":"service-desc","title":"API description","type":"application/vnd.oai.openapi+json;version=3.0"}],"timeStamp":"2023-06-06T15:56:53Z"} |
What is the bug or the crash?
For requests to QGIS server it is possible to set the HEADER
X-Qgis-Service-Url
(see here). This causes the server to display a different URL of itself in the responses, for example in the capabilities document.This works well for the traditional OGC standards like WMS and WFS. But it does not work for OGC API Features.
Steps to reproduce the issue
Start a QGIS Server:
Make a request to a project that has WFS/OGC API Features activated:
The actual response is:
The expected response should be:
The links in the document should be replaced by the URL provided in the HEADER
X-Qgis-Service-Url
Versions
QGIS Server is started via this docker image:
camptocamp/qgis-server:3.28
(link to repo]Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: