HTTP 404 Livewire.js

Hi guys, I am facing a - atleast it seems like - common problem with HTTP 404 /livewire/livewire.js. But somehow I can't fix it.
10 Replies
alexanderkroneis
alexanderkroneisOPβ€’16mo ago
server {
listen 80;
listen [::]:80;

root /var/www/public;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

server_tokens off;

index index.php;

charset utf-8;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

error_page 404 /index.php;

location ~ \.php$ {
fastcgi_pass localhost:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_hide_header X-Powered-By;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}

gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";

location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
try_files $uri $uri/ /index.php?$query_string;
access_log off;
log_not_found off;
expires 14d;
}
}
server {
listen 80;
listen [::]:80;

root /var/www/public;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

server_tokens off;

index index.php;

charset utf-8;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

error_page 404 /index.php;

location ~ \.php$ {
fastcgi_pass localhost:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_hide_header X-Powered-By;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}

gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";

location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
try_files $uri $uri/ /index.php?$query_string;
access_log off;
log_not_found off;
expires 14d;
}
}
Dennis Koch
Dennis Kochβ€’16mo ago
Your webserver isn't set up to deliver js files I see you already found the relevant LW post. Just to be sure: You restarted nginx after making the change?
alexanderkroneis
alexanderkroneisOPβ€’16mo ago
Yes, I re-deployed the application. Maybe for some context: I'm using a Docker Compose setup with Traefik as a Reverse Proxy. The container is running behind that proxy - I don't know if that's relevant in anyway. I am using a similar setup (Traefik / Docker Compose) at my local environment, it's working perfectly fine over here.
Dennis Koch
Dennis Kochβ€’16mo ago
Weird one.
alexanderkroneis
alexanderkroneisOPβ€’16mo ago
Yes. πŸ˜‚
Dennis Koch
Dennis Kochβ€’16mo ago
Yeah, sorry. I guess it's impossible to debug this one via Discord πŸ™ˆ
alexanderkroneis
alexanderkroneisOPβ€’16mo ago
Don't worry, I'll continue debugging. I'll let you know The URL is available when I call it via browser. πŸ€” We're getting somewhere.
Dennis Koch
Dennis Kochβ€’16mo ago
Oh, somebody else had something similar. I guess it was the caching stuff
alexanderkroneis
alexanderkroneisOPβ€’16mo ago
seems to be true. πŸ˜‚ Safari is working, Chrome is returning 404. Thank you!
farhanshares
farhansharesβ€’16mo ago
I had the issue and been debugging for the last couple of hours. /livewire/livewire.js is handled by laravel router but it is being treated as static files by nginx/traefic. Either define a location block in nginx config to specially handle that route, or, change the livewire route (e.g. make it /livewire/livewire-js).
Want results from more Discord servers?
Add your server