Skip to content

Commit

Permalink
Update headers config
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Sep 13, 2023
1 parent d2b2bd0 commit bdcd980
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
22 changes: 11 additions & 11 deletions images/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ RUN apt-get update && apt-get -y install libpqxx-dev libfcgi-dev zlib1g-dev \
rm -rf /var/lib/apt/lists/*

# Install cgimap
ENV cgimap /tmp/openstreetmap-cgimap
ENV CGIMAP_GITSHA=5cd3d21bebe9d205828608be4c65bbda8b464308
RUN git clone -b master https://github.com/zerebubuth/openstreetmap-cgimap.git $cgimap
RUN cd $cgimap && git checkout $CGIMAP_GITSHA
RUN cd $cgimap && \
./autogen.sh && \
./configure && \
make && \
make install
# ENV cgimap /tmp/openstreetmap-cgimap
# ENV CGIMAP_GITSHA=5cd3d21bebe9d205828608be4c65bbda8b464308
# RUN git clone -b master https://github.com/zerebubuth/openstreetmap-cgimap.git $cgimap
# RUN cd $cgimap && git checkout $CGIMAP_GITSHA
# RUN cd $cgimap && \
# ./autogen.sh && \
# ./configure && \
# make && \
# make install

# Install svgo required
RUN npm install -g svgo
Expand Down Expand Up @@ -78,6 +78,8 @@ RUN ln -s /tmp /var/www/tmp

# Add Apache configuration file
ADD config/production.conf /etc/apache2/sites-available/production.conf
RUN a2enmod headers
RUN a2enmod setenvif
RUN a2dissite 000-default
RUN a2ensite production

Expand All @@ -88,8 +90,6 @@ RUN apt-get update && apt-get install -y libapache2-mod-passenger lighttpd
# Enable the Passenger Apache module and restart Apache
RUN echo "ServerName $(cat /etc/hostname)" >> /etc/apache2/apache2.conf
RUN a2enmod passenger
RUN a2enmod headers
RUN a2enmod setenvif

# Check installation
RUN /usr/bin/passenger-config validate-install
Expand Down
11 changes: 8 additions & 3 deletions images/web/config/production.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http

# Handle preflight requests
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ACCESS_CONTROL_ALLOW_HEADERS: Origin, X-Requested-With, Content-Type, Accept]
# # Handle preflight requests
# RewriteCond %{REQUEST_METHOD} OPTIONS
# RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ACCESS_CONTROL_ALLOW_HEADERS: Origin, X-Requested-With, Content-Type, Accept]

# CORS headers
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

# Avoid redirects for preflight
RewriteCond %{REQUEST_METHOD} !OPTIONS
Expand Down

0 comments on commit bdcd980

Please sign in to comment.