I have manually built an angularjs application, and uploaded it to Netlify.
I am having some problems understanding why I get a status 301 on some request, and a 200 on other requests that are located in the same folder (under dist/scripts).
I have a script file:
hostname/scripts/script.123.js (this gives me 301)
hostname/scripts/vendor.987.js (this gives me 200)
When I build my application, there is a grunt task concatenating all .js files, and create a new file with a new id (e.g. 123).
The 301 redirect disappears after a while, but it usually happens right after I create a new build and upload it. The script.123.js file gets renamed to e.g. script.456.js. The vendor’s id usually stays the same, as it only updates if I add/change node_modules or bower_components.
I thought maybe there were some caching issues related to the 301, but I am not sure. Any suggestions or help is appreciated.
The behaviour is somewhat different from browser to browser, and incognito window. In some browsers the response is 200 ok, while others give me 301. It seems that the response turns to 200 ok after a certain amount of time though.
We managed to use CI, with automated builds from bitbucket (instead of dragging our dist folder into Netlify), and the the same problem has not occurred (yet). Maybe Netlify is doing something important when they build the application instead of us.
Hi @johnedvard, can you share links to the URL’s that are giving you the 301 errors? Note that previous deploys are still linkable from your site.
Hello, and thank you for taking your time to have a look at this. After migrating to automated builds (using bitbucket through Netlify), the problem ceased to exist. I would preferably send this as a message to you directly instead of posting it here on the forum, but I could not find a “Send PM” button. Anyway, here it is.
Open up https://5d24894bf621cc42e857cb5b–ibricks.netlify.com/fill/task/asd
(and requests for https://5d24894bf621cc42e857cb5b–ibricks.netlify.com/portal/scripts/fillScripts.4a9386bd.js), but cannot find it.
(and requests for https://5d25daa5afec4f5f368b7022–ibricks.netlify.com/scripts/vendor.f7334bd5.js), and finds it.
I tried to download the zip file of the repository, but to my surprise,
scripts/vendor.f7334bd5.js is not present in the project, but
scripts/fillScripts.4a9386bd.js is present. I thought maybe it would be the other way around.
I think one of two things is happening:
you have a service worker and your asset renaming confuses it. This article has more details: [Common Issue] Why do I see “Uncaught SyntaxError: Unexpected token <” errors? How can I use chunking or versioning for my assets at Netlify?
you’re not building+deploying what you think you are. This is the most frequent cause of site misbehavior - we built something that was not what you were expecting. The below screenshot shows how to download a copy of any successful deploy from its logs page in our UI. Then you’ll know if we are debugging “failure to serve” or “failure to build”, which have very different paths.
Could be wrong, but those are my best guesses tonight