From ddea3ea01ec90b49888efb9a40d2448fb2e94ff8 Mon Sep 17 00:00:00 2001 From: Maarten Sijm <9739541+mpsijm@users.noreply.github.com> Date: Tue, 28 Mar 2023 21:53:37 +0200 Subject: [PATCH] Redirect 2020.bapc pages to index.html for JavaScript routing --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cb4914f..c46f707 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,10 @@ FROM wisvch/nginx USER root RUN sed -i -r '/server \{.*/a\ absolute_redirect off;' /etc/nginx/conf.d/default.conf RUN sed -i -r 's/server_name.*/server_name "~^(?\\d{4})\\.(?.+)$";/g' /etc/nginx/conf.d/default.conf +RUN sed -i -r '/index.htm;/a\ location ~ /(home|preliminaries|scoreboard-preliminaries|schedule|system|registration|rules|problems|scoreboard|organisation|contact)$ { if ($year = 2020) { rewrite ^.*$ /index.html last; } }' /etc/nginx/conf.d/default.conf RUN sed -i -r '1,/root \/srv;/s//root \/srv\/$year;/' /etc/nginx/conf.d/default.conf # Serve sample/code files as plain text, instead of downloading them -RUN sed -i -r '/location \/.*/a\ location ~ \\.(in|out|c|cpp|java|pas|py)$ { types {} default_type text/plain; }' /etc/nginx/conf.d/default.conf +RUN sed -i -r '/location \/.*/a\ location ~ \\.(in|out|c|cpp|java|pas|py)$ { types {} default_type text/plain; }' /etc/nginx/conf.d/default.conf USER 100 COPY --link 2001.bapc.eu /srv/2001 COPY --link 2002.nwerc.eu /srv/2002