Add ALLOW_CORS parameter
This commit is contained in:
parent
8744ab2792
commit
451f335bc5
@ -131,7 +131,8 @@ RUN mkdir /var/lib/mod_tile \
|
|||||||
&& mkdir /var/run/renderd \
|
&& mkdir /var/run/renderd \
|
||||||
&& chown renderer /var/run/renderd
|
&& chown renderer /var/run/renderd
|
||||||
RUN echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf \
|
RUN echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf \
|
||||||
&& a2enconf mod_tile
|
&& echo "LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so" >> /etc/apache2/conf-available/mod_headers.conf \
|
||||||
|
&& a2enconf mod_tile && a2enconf mod_headers
|
||||||
COPY apache.conf /etc/apache2/sites-available/000-default.conf
|
COPY apache.conf /etc/apache2/sites-available/000-default.conf
|
||||||
COPY leaflet-demo.html /var/www/html/index.html
|
COPY leaflet-demo.html /var/www/html/index.html
|
||||||
RUN ln -sf /proc/1/fd/1 /var/log/apache2/access.log \
|
RUN ln -sf /proc/1/fd/1 /var/log/apache2/access.log \
|
||||||
|
13
README.md
13
README.md
@ -79,6 +79,19 @@ docker run \
|
|||||||
|
|
||||||
This will enable a background process that automatically downloads changes from the OpenStreetMap server, filters them for the relevant region polygon you specified, updates the database and finally marks the affected tiles for rerendering.
|
This will enable a background process that automatically downloads changes from the OpenStreetMap server, filters them for the relevant region polygon you specified, updates the database and finally marks the affected tiles for rerendering.
|
||||||
|
|
||||||
|
### Cross-origin resource sharing
|
||||||
|
|
||||||
|
To enable the `Access-Control-Allow-Origin` header to be able to retrieve tiles from other domains, simply set the `ALLOW_CORS` variable to `1`:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run \
|
||||||
|
-p 80:80 \
|
||||||
|
-v openstreetmap-data:/var/lib/postgresql/10/main \
|
||||||
|
-e ALLOW_CORS=1 \
|
||||||
|
-d overv/openstreetmap-tile-server \
|
||||||
|
run
|
||||||
|
```
|
||||||
|
|
||||||
## Performance tuning and tweaking
|
## Performance tuning and tweaking
|
||||||
|
|
||||||
Details for update procedure and invoked scripts can be found here [link](https://ircama.github.io/osm-carto-tutorials/updating-data/).
|
Details for update procedure and invoked scripts can be found here [link](https://ircama.github.io/osm-carto-tutorials/updating-data/).
|
||||||
|
@ -10,4 +10,8 @@
|
|||||||
|
|
||||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
|
||||||
|
<IfDefine ALLOW_CORS>
|
||||||
|
Header set Access-Control-Allow-Origin "*"
|
||||||
|
</IfDefine>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
5
run.sh
5
run.sh
@ -69,6 +69,11 @@ if [ "$1" = "run" ]; then
|
|||||||
# Fix postgres data privileges
|
# Fix postgres data privileges
|
||||||
chown postgres:postgres /var/lib/postgresql -R
|
chown postgres:postgres /var/lib/postgresql -R
|
||||||
|
|
||||||
|
# Configure Apache CORS
|
||||||
|
if [ "$ALLOW_CORS" == "1" ]; then
|
||||||
|
echo "export APACHE_ARGUMENTS='-D ALLOW_CORS'" >> /etc/apache2/envvars
|
||||||
|
fi
|
||||||
|
|
||||||
# Initialize PostgreSQL and Apache
|
# Initialize PostgreSQL and Apache
|
||||||
CreatePostgressqlConfig
|
CreatePostgressqlConfig
|
||||||
service postgresql start
|
service postgresql start
|
||||||
|
Loading…
Reference in New Issue
Block a user