Skip to content

Commit

Permalink
Enable cgimap
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Jun 10, 2024
1 parent 63842b9 commit e086045
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 37 deletions.
45 changes: 18 additions & 27 deletions images/web/config/production.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,31 @@
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
# Development mode in case domain is localhost

# ======Redirect to HTTPS
RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP_HOST} !=127.0.0.1
# RewriteCond %{HTTPS} off
# RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ======Redirect to wwww osmseed.org
# RewriteCond %{HTTP_HOST} =osmseed.org
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
; ======Redirect to wwww osmseed.org
; RewriteCond %{HTTP_HOST} =osmseed.org
; RewriteCond %{HTTP_HOST} !^www\. [NC]
; RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# <Location />
# # For TM, do not use cgimap auth.
# <If "%{HTTP_REFERER} !~ m#https://tasks(-\w+)?\.osmseed\.org/#">
# CGIPassAuth On
# </If>
# </Location>
<Location />
CGIPassAuth On
</Location>

# ======Proxying traffic to CGImap====
# RewriteCond %{REQUEST_URI} ^/api/0\.6/map
# RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
# RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]

# For changeset requests originating from TM, do not use cgimap.
# RewriteCond %{REQUEST_METHOD} ^POST$
# RewriteCond %{HTTP_REFERER} !^https://tasks(-\w+)?\.osmseed\.org/ [NC]
# RewriteRule ^/api/0\.6/changeset/[0-9]+/(upload|download)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteCond %{REQUEST_URI} ^/api/0\.6/map
RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]

# Relax Apache security settings
<Directory /var/www/public>
Expand Down
20 changes: 10 additions & 10 deletions images/web/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ while "$flag" = true; do
fi
sleep 2
done &
# time rails i18n:js:export assets:precompile
time rails i18n:js:export assets:precompile
bundle exec rails db:migrate
# /usr/local/bin/openstreetmap-cgimap \
# --port=8000 \
# --daemon \
# --instances=10 \
# --dbname=$POSTGRES_DB \
# --host=$POSTGRES_HOST \
# --username=$POSTGRES_USER \
# --password=$POSTGRES_PASSWORD \
# --logfile log/cgimap.log
/usr/local/bin/openstreetmap-cgimap \
--port=8000 \
--daemon \
--instances=3 \
--dbname=$POSTGRES_DB \
--host=$POSTGRES_HOST \
--username=$POSTGRES_USER \
--password=$POSTGRES_PASSWORD \
--logfile log/cgimap.log
bundle exec rake jobs:work &
apachectl -k start -DFOREGROUND
done

0 comments on commit e086045

Please sign in to comment.