Search code examples
gdalqgis

GDAL vsis3 through QGIS Server


I'm trying to serve a WMS through QGIS Server, based on a project file referencing data with the vsis3 interface, but it doesn't work.

It works fine with vsicurl but not vsis3, despite attempts to set the AWS_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables as global environment variables on the server and also with FcgidInitialEnv in the httpd.conf file (I'm using Apache).

The project file works fine within the QGIS desktop interface, thanks to the global AWS_* environment variables, so I suspect that QGIS Server doesn't use the environment variables or the variables set in httpd.conf properly. Setting QGIS_SERVER_LOG_FILE and CPL_LOG with FcgidInitialEnv in the httpd.conf file, I can see "Data source is invalid ()" in the QGIS Server log file (sadly no CPL error code within parantheses) and "ERROR 15: AWS_SECRET_ACCESS_KEY configuration option not defined" in the CPL log file, suggesting that getenv("AWS_SECRET_ACCESS_KEY") from the GDAL code doesn't return anything although I set it in two different ways, so my initial suspicion is probably correct.

Anyone got a clue? How can I pass the AWS_* variables correctly to GDAL via QGIS Server?


Solution

  • Solved! For future reference, I had to use SetEnv instead of FcgidInitialEnv or DefaultInitEnv for the AWS_* variables, so they appear as ordinary environment variables I guess.