Fixing CORS headers for Zim, Help, and Map.

This commit is contained in:
Roland 2024-06-18 11:36:09 -06:00
parent f63a3cc0a6
commit 8f3d14af78
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
3 changed files with 38 additions and 32 deletions

View file

@ -1,43 +1,47 @@
<VirtualHost *:8084>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
ServerAdmin webmaster@localhost
LoadTileConfigFile /etc/renderd.conf
ModTileRenderdSocketName /run/renderd/renderd.sock
# Timeout before giving up for a tile to be rendered
ModTileRequestTimeout 0
# Timeout before giving up for a tile to be rendered that is otherwise missing
ModTileMissingRequestTimeout 30
LoadTileConfigFile /etc/renderd.conf
ModTileRenderdSocketName /run/renderd/renderd.sock
# Timeout before giving up for a tile to be rendered
ModTileRequestTimeout 0
# Timeout before giving up for a tile to be rendered that is otherwise missing
ModTileMissingRequestTimeout 30
DocumentRoot /var/www/html
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/nginx/cert.crt
SSLCertificateKeyFile /etc/nginx/cert.key
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Allow-Headers "Content-Type"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View file

@ -54,6 +54,7 @@ http {
listen 8085 ssl;
listen [::]:8085 ssl;
proxy_pass_header Host;
proxy_set_header 'Access-Control-Allow-Origin' '*';
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
@ -68,6 +69,7 @@ http {
listen 8086 ssl;
listen [::]:8086 ssl;
proxy_pass_header Host;
add_header 'Access-Control-Allow-Origin' '*';
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;

View file

@ -10,16 +10,16 @@ git config --global --add safe.directory /opt/openstreetmap-carto
chown -R wrolpi:wrolpi /opt/openstreetmap-carto
(cd /opt/openstreetmap-carto && carto project.mml >/opt/openstreetmap-carto/mapnik.xml)
# WROLPi user can access WROLPi and Map database.
# All users can access wrolpi and map database.
cat >/etc/skel/.pgpass <<'EOF'
127.0.0.1:5432:gis:_renderd:wrolpi
127.0.0.1:5432:wrolpi:wrolpi:wrolpi
EOF
# Update desktop shortcuts.
# Copy desktop shortcuts.
mkdir /etc/skel/Desktop
cp /opt/wrolpi/etc/raspberrypios/*desktop /etc/skel/Desktop
# Configure renderd.
# Configure renderd (map).
cp /opt/wrolpi/etc/raspberrypios/renderd.conf /etc/renderd.conf
# Configure Apache2 to listen on 8084. Import renderd into apache.
cp /opt/wrolpi/etc/raspberrypios/ports.conf /etc/apache2/ports.conf