[Vuejs]-Vite reverse proxy not working on nginx docker setup

0👍

Turns out the rules defined in vite.config.ts did not apply for production mode so I had to rewrite them in the nginx.conf file like below

events {
}

http {
    include mime.types;

    server {
        listen 80;
        server_name localhost;
        root /usr/share/nginx/html;

        location /auth/login-user {
          proxy_pass http://back-end:8081/backend/auth/user/login;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
        }

        location /user/create-user {
          proxy_pass http://back-end:8081/backend/auth/user/create;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
        }


    }
}

Leave a comment