seb_run's avatar

Vite : Wrong domain on production

Hi,

I deployed my project on production and my build/assets/ js & css are served from a wrong domain, it's using the private IP adress of the server instead of the full domain. https://192.168.XX.XX/build/assets/WWW.css

I try to npm run build on production but same.

The APP_URL in .env is set to the full domain https://xxx.yyy.com/

I try to add a base property in my vite.config.js.

I search for the private IP string in all my laravel project and i cannot found anything.

I check and i don't have any /public/hot/ on the production server.

Where does vite get the base url when dealing with @vite(['resources/css/app.css', 'resources/js/app.js']) in a blade file in a production env ??

Thx for your help

0 likes
1 reply
seb_run's avatar

found the solution !

it was on the nginx reverse proxy configuration :

the proxy_pass was set to the private IP of the server instead of the domain.

location / {
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-Port 443;
            proxy_pass https://mydomain.com;
    }    

Please or to participate in this conversation.