Skip to content

Commit

Permalink
fix ui redirects from docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Slawomir Wieczorek committed Jan 18, 2024
1 parent b27a992 commit c152347
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ services:

hello-data-portal-ui:
build:
context: base/hello-data-portal-ui
context: base/portal
dockerfile: Dockerfile
args:
HELLO_DATA_AUTH_SERVER_URL: ${HELLO_DATA_AUTH_SERVER_URL}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ RUN echo "window.environment = { \
} \
}" > /app/config/environment.js

COPY nginx.conf /etc/nginx/nginx.conf

RUN chown -R nginx: /app

EXPOSE 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

FROM nginx:1
FROM nginx:1.25.3

LABEL MAINTAINER="HelloDATA Team"

COPY hello-data-portal-ui /app

RUN rm -rf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/nginx.conf
COPY csp.conf /etc/nginx/conf.d/csp.conf.template

Expand Down
12 changes: 11 additions & 1 deletion hello-data-portal/hello-data-portal-ui/build/docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ http {
# X-XSS-Protection
add_header X-XSS-Protection "1; mode=block";

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

server {
listen 127.0.0.1:80;
server_name 127.0.0.1;
Expand All @@ -107,10 +111,16 @@ http {
client_max_body_size 1024m;
index index.html index.htm;

location = / {
absolute_redirect off;
rewrite ^/$ /app/ redirect;
try_files $uri $uri/ @app;
}

location @app {
rewrite ^$ /app/ redirect;
rewrite ^/$ /app/ redirect;
rewrite ^/app$ index.html;
rewrite ^/app$ /index.html;
rewrite ^/app.*$ /index.html;
try_files $uri $uri/ /index.html;
}
Expand Down

0 comments on commit c152347

Please sign in to comment.