Added custom errors routing

This commit is contained in:
Alexey Safronov 2024-02-26 20:42:04 +04:00
parent 4ec5b38b29
commit 7eccceca02
2 changed files with 26 additions and 0 deletions

View File

@ -378,4 +378,28 @@ server {
rewrite /healthchecks/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:5033;
}
error_page 401 /custom_401.html;
location = /custom_401.html {
root /etc/nginx/html;
internal;
}
error_page 403 /custom_403.html;
location = /custom_403.html {
root /etc/nginx/html;
internal;
}
error_page 404 /custom_404.html;
location = /custom_404.html {
root /etc/nginx/html;
internal;
}
error_page 500 502 503 504 /custom_50x.html;
location = /custom_50x.html {
root /etc/nginx/html;
internal;
}
}

View File

@ -15,6 +15,7 @@ RUN find config/ -maxdepth 1 -name "*.json" | grep -v test | grep -v dev | xargs
tar -C "/app/onlyoffice/" -xvf config.tar && \
cp config/*.config /app/onlyoffice/config/ && \
mkdir -p /etc/nginx/conf.d && cp -f config/nginx/onlyoffice*.conf /etc/nginx/conf.d/ && \
mkdir -p /etc/nginx/html && cp -f config/nginx/html/* /etc/nginx/html/ && \
mkdir -p /etc/nginx/includes/ && cp -f config/nginx/includes/onlyoffice*.conf /etc/nginx/includes/ && \
sed -i "s/\"number\".*,/\"number\": \"${PRODUCT_VERSION}.${BUILD_NUMBER}\",/g" /app/onlyoffice/config/appsettings.json && \
sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf
@ -92,6 +93,7 @@ RUN apt-get -y update && \
# copy static services files and config values
COPY --from=base /etc/nginx/conf.d /etc/nginx/conf.d
COPY --from=base /etc/nginx/html /etc/nginx/html
COPY /buildtools/install/docker/config/nginx/docker-entrypoint.sh /docker-entrypoint.sh
COPY /buildtools/install/docker/config/nginx/docker-entrypoint.d /docker-entrypoint.d