camptocamp / docker-qgis-server

All that is needed to generate a proper QGIS server image
GNU General Public License v2.0
35 stars 8 forks source link

Q: How to enable SSL/https for WFS3 HTML View #189

Open justb4 opened 2 years ago

justb4 commented 2 years ago

Could not find in the QGIS Server documentation. May apply also to WMS, WFS, WMTS. Our QGIS Desktop version is 3.16.0-Hannover | QGIS code revision | 4af1cbfb97

Our QGIS Server instance runs behind Traefik using https://.

GeoJSON Features are returned ok. But as HTML internal requests requests are using http://. For example: https://apitestbed.geonovum.nl/qgis/wfs3/collections/dutch_addresses_4326%20OGRGeoJSON/items.html? The map remains empty and in the browser Console we see this error:

jquery-3.4.1.min.js:2 Mixed Content: The page at 'https://apitestbed.geonovum.nl/qgis/wfs3/collections/dutch_addresses_4326%20OGRGeoJSON/items.html' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://apitestbed.geonovum.nl/qgis/wfs3/collections/dutch_addresses_4326%20OGRGeoJSON/items.geojson?'. This request has been blocked; the content must be served over HTTPS.
send @ jquery-3.4.1.min.js:2

There may be a setting or so, but can't find. The QGIS Server service is defined in GitHub: https://github.com/Geonovum/ogc-api-testbed/tree/main/services/qgis . The Docker Image we use is: camptocamp/qgis-server latest 7fb64088c423 14 months ago 1.35GB.

Ok very old...I tried newer Docker Image versions like master and 3.16 but then got other errors like on the landing page: https://apitestbed.geonovum.nl/qgis/wfs3/

[
  {
    "code": "Bad request error",
    "description": "Template not found: getLandingPage.html"
  }
]
swiss-knight commented 2 years ago

I'm experiencing a similar issue; the GeoJSON feature seems transferred using HTTP instead of HTTPS when browsing this particular URL: https://my-server.ch/wfs3/collections/collection1/items/1.html

It shows "Mixed Block" in the Network panel under "Transferred" and the mini Leaflet map is center on Null Island with no feature displayed.

But, always in the network panel, if I right click the GeoJSON feature which wasn't transferred > "Open in new tab", then I opens correctly using HTTPS: https://my-server.ch/wfs3/collections/collection1/items/1.geojson

I am using the latest image at the time of writing: "camptocamp/qgis-server:3.22"

sbrunner commented 1 year ago

We use a frontend for that...