camptocamp / docker-qgis-server

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

Rewrite Rules #1292

Closed JakobMiksch closed 1 month ago

JakobMiksch commented 1 month ago

Is there a way to add custom rewrite rules?

like in this example below, I would like to always use a predefined DB Service

    RewriteEngine On
    # Endpoint for QGIS projects stored in PostgreSQL DB
    RewriteRule ^${URL_PREFIX}/pg/(.+)/(.+)$ /cgi-bin/qgis_mapserv.fcgi?map=postgresql\%3A\%2F\%2F\%2F\%3Fservice\%3D${DB_PROJECT_SERVICE}\%26schema=$1\%26project=$2 [QSA,PT]
    # Endpoint for file based QGIS projects
    RewriteRule ^${URL_PREFIX}/(.*)$ /cgi-bin/qgis_mapserv.fcgi?map=/data/$1.${QGIS_PROJECT_SUFFIX} [QSA,PT]
    # Forbid direct access
    RewriteRule ^/cgi-bin/.*$ - [F]

https://github.com/qwc-services/qwc-qgis-server/blob/c07c5bae23b28e8e17c43e4a62000181717f9bec/qgis3-server.conf.template#L14-L20

sbrunner commented 1 month ago

For that, the simple is to add a file in the container, in the folder runtime/etc/apache2/conf-enabled/.

JakobMiksch commented 1 month ago

Thanks. I solved it like this: https://github.com/siticom/docker-qgis-server-postgres