Recently I wanted to add a custom 404 page for my user page (https://soykje.gitlab.io), but for an unknown reason I get 503 and redirected to authentification page (login/signup).
What could be the reason of that? Is it possible to get a functional custom 404 page on Gitlab user page?
Hi, thx for your message. If I understood well the doc, my custom 404 is correctly generated, as I end with a 404.html file at the root of my public folder…
But as it still doesn’t work, there should be something I missed, in my project configuration or my .gitlab-ci.yml?
Just in case, here it is:
image: node:lts
cache:
paths:
- node_modules/
pages:
before_script:
# Clean 'public' directory
- find public -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
- find public -type f -name "*.html" | xargs rm -rf
# Install packages
- npm install
script:
# Build application and move content to 'public' directory
- npm run publish
# We need a last cleanup as mv command doesn't allow us to merge directories
- find public -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
# We need to move and rename 404 file to make it work properly
- mv out/404/index.html out/404.html
- rm -d out/404
# We copy output inside expected 'public' directory
- mv out/* public
after_script:
# Cleanup
- rm -rf out
artifacts:
paths:
- public
only:
- master
Doing this, I’m getting a public directory such as: