Eigener Tileserver hat CORS Issues in Apache2 mit Tirex und mod_tile

Hallo,

wir haben einen eigenen Tileserver mit mod_tile und Tirex den wir für die Öffentlichkeit bereitstellen. (mit eigenen tiles)

Leider bekommen wir ein CORS Error wenn wir folgenden Request senden…

curl -I -H "Origin: https://localhost:3000" https://tiles.oklabflensburg.de/fosm/11/1076/655.png

HTTP/2 403 
content-type: text/html; charset=iso-8859-1
date: Wed, 26 Mar 2025 07:57:27 GMT
server: Apache

jedoch wenn bei diesem Requst nicht:

curl -I https://tiles.oklabflensburg.de/fosm/11/1076/655.png

HTTP/2 200 
etag: "36e74e33ced21fb791d1b16efdbafefc"
content-length: 16410
cache-control: max-age=88345
expires: Thu, 27 Mar 2025 08:30:57 GMT
vary: Accept-Encoding
x-content-type-options: nosniff
content-security-policy: frame-ancestors 'self';
access-control-allow-origin: *
access-control-allow-methods: GET, OPTIONS
access-control-allow-headers: X-Requested-With, Content-Type
access-control-allow-credentials: true
content-type: image/png
date: Wed, 26 Mar 2025 07:58:32 GMT
server: Apache

Im Apache Error Log: /var/log/apache2/error.log.

[Wed Mar 26 09:01:43.758631 2025] [tile:info] [pid 1301019:tid 125281859798720] [remote xx.xx.xx.xx:28294] Origin header (https://localhost:3000) is NOT allowed under the CORS policy (). Rejecting request

Unsere Config sieht wie folgt aus:

<VirtualHost *:80>
    ServerName tiles.oklabflensburg.de
    Protocols h2 http/1.1

    # Redirect HTTP to HTTPS
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =tiles.oklabflensburg.de
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName tiles.oklabflensburg.de
    Protocols h2 http/1.1

    SSLEngine On

    # Tile server configuration
    ModTileTileDir /data/tiles
    LoadTileConfigFile /etc/tirex/mod_tile_tirex.conf
    ModTileEnableStats On
    ModTileBulkMode Off

    # Timeout before giving up for a tile to be rendered
    ModTileRequestTimeout 3

    # Timeout before giving up for a tile to be rendered that is otherwise missing
    ModTileMissingRequestTimeout 10

    ModTileMaxLoadOld 16
    ModTileMaxLoadMissing 50

    ModTileRenderdSocketName /run/tirex/modtile.sock

    # Caching configuration
    ModTileCacheDurationMax 604800
    ModTileCacheDurationDirty 900
    ModTileCacheDurationMinimum 10800
    ModTileCacheDurationMediumZoom 13 86400
    ModTileCacheDurationLowZoom 9 518400
    ModTileCacheLastModifiedFactor 0.20

    # Tile Throttling
    ModTileEnableTileThrottling Off
    ModTileEnableTileThrottlingXForward 0
    ModTileThrottlingTiles 10000 1
    ModTileThrottlingRenders 128 0.2

    # Use gzip compression for tiles
    AddOutputFilterByType DEFLATE image/png

    # Logging and SSL Configuration
    LogLevel debug
    SSLCertificateFile /etc/letsencrypt/live/tiles.oklabflensburg.de/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/tiles.oklabflensburg.de/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

Wir freuen uns über Ideen, Erfahrungen und vor allem Unterstützung bei diesem Issue.

Ich habe es herausgefunden. Ich musste in die Tirex Config einfach schreiben:

CORS=*