No 'Access-Control-Allow-Origin' header for https://projects.gitlab.io/auth

Hello, I am trying to setup a very simple boilerplate on Gitlab Pages. I have created a new vuejs project (built with vitejs) which is working properly on my local machine. When I try to deploy it on Gitlab Pages, the pipeline is executed properly but I have a blank-page and a CORS issue with https://projects.gitlab.io/auth

Here is my .gitlab-ci.yml

image: node:latest
pages:
  cache:
    paths:
    - node_modules/
  script:
    - yarn
    - yarn build
    # - rm -R public
    - mv dist public # rename the dist folder
    # optionally, you can activate gzip support with the following line:
    # - find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
  artifacts:
    paths:
      - public
  only:
    - master

And Gitlab confirmed where my pages is published
Your pages are served under:
https://dashtooling.gitlab.io/velibmonitor

My project is private but the Pages settings is set to Everyone. And I did not change any settings of the parent group. I really don’t know what is generating this CORS error on Vite App :frowning:

The index.html itself is correctly fetched by the error is generated by the subsequent .js files which are the output built by Vue.

If someone can point me in the right direction, thanks !

Problem solved:
As my Gitlab repository is in a subgroup, my vite.config.js file must have the base parameter configured accordingly:

export default defineConfig({
  base: '/NAME OF THE REPO/',
  ...
})
1 Like