I am deploying a simple Vue app. Everything works fine with netlify domain
xxx.netlify.com but it is not working with my primary domain mydomain.com
The problem is when you load the page, the main js file (created in the build) is not there. So, comparing both files in both cases:
xxx.netlify.com/js/app.a23a34e2.js —> works fine
mydomain.com/js/app.bb389afb.js —> returns 404 error HTML page
I realized the names of the files are different, it makes no sense because they should work against the same build.
Also, if I try with my domain and the js file name from the netlify domain, it works fine:
I have tried to run a “clear cache and deploy site” but the problem is still there.
The build configuration seems ok:
Build command: npm run build
Publish directory: dist
So, it seems like a bug or am I doing something wrong?
I don’t know if this might be part of your issue, but Netlify’s CDN works best with FQDN, so
www.mydomain.com is going to be properly cached, while mydomain.com will not be.
You might try setting
www.mydomain.com as your primary domain in the Netlify dashboard under Settings --> Domain Management --> Domains.
@pedromartin, and welcome to our Netlify community site.
What are the actual URLs which do and do not work? If you would prefer to send this information to us privately you can send that to one of our support team in a private message (PM).
Please note, sending a PM means the rest of the support team cannot see the message and will likely result is a slower response than a public answer.
Hi, thanks for both responses.
These are the URLs:
https://pedromartin.pro —> https://pedromartin.pro/js/app.bb389afb.js
https://agitated-ptolemy-7426d5.netlify.com —> https://agitated-ptolemy-7426d5.netlify.com/js/app.a23a34e2.js
And as I said, if I try
https://pedromartin.pro/js/app.a23a34e2.js, it works.
@pedromartin, I’m seeing that this site has a single page application (SPA) redirect rule configured for it.
For files which don’t exist there is a 200 redirect to the path
This file (at the path
However, this file does not exist in the current deploy:
This means both of the URLs below also return 200 response but serve
My best guess is that this file existed in a previous deploy and it used to work but doesn’t anymore because a new deploy has been published without it.
If there are other questions about this, please let us know.
Yes, it is basically what I said previously and the problem. So let me be more clear.
https://agitated-ptolemy-7426d5.netlify.com is running properly against the last build (it is configured to make a build in every push to master) but https://pedromartin.pro is not using the last one (at least some files seem to be cached)
My question: why
https://agitated-ptolemy-7426d5.netlify.com is returning the right js file and the https://pedromartin.pro is using a previous one? shouldn’t they be exactly the same?
My guess: some cache problem on your side or a configuration problem (in netlify) on my side.
@pedromartin, I’m seeing this site using a service worker. This is the most likely reason for this behavior. You’ll need to uninstall the service worker locally to resolve that issue.
There is more information about this at the topic link below:
Last checked by Netlify Support Team on September 22, 2021
service worker is a script that your browser runs in the background to accomplish a variety of tasks. Browsers cache service workers for 24 hours by default, and don’t update them when you reload your page. Therefore, you may have a service worker on your site which could prevent you from seeing the latest and greatest changes that you’ve made.
If you suspect a service worker is causing this issue, I recommend disabling/removing the …
If you believe that Netlify is sending the wrong version, we need to be able to track the HTTP response with this issue. The simplest way to do this is to send us the
x-nf-request-id header with every HTTP response.
There more information about this header here:
Last reviewed by Netlify Support: October 2021
What is the x-nf-request-id header?
Web servers and web browsers communicate using a protocol called HTTP - which stands for “HyperText Transfer Protocol”. Both web browsers and web servers use a feature called headers as part of this protocol.
The headers that web browsers send are called “request headers” because the browser in making an “HTTP request”.
The web servers headers are called “response headers” because web servers send an “HTTP res…
If that header isn’t available for any reason, please send the information it replaces (or as many of these details as possible). Those details are:
the complete URL requested
the IP address for the system making the request
the IP address for the CDN node that responded
the day of the request
the time of the request
the timezone the time is in
Again, I don’t think
x-nf-request-id header will be required though as I’m 99.9% certain this is the service worker doing this. (I’m 100% certain there is a service worker.) If there are other questions about this, please let us know.