Closed cpbennett4 closed 6 years ago
Well, you could use express and specific a way to serve the static files like this:
app.use(express.static('dist'));
Where dist is the folder where you bundle is, and all static files (html, css, js)
Hey, I have no idea how I missed this originally. 😰
This would probably be a better question for the NGINX community; I haven't seen this issue before, and I'm not super familiar with the nuts and bolts of how NGINX decides what the content-type should be for a file.
@aeciolevy also makes a good point, which is that Express will handle a lot of this on your behalf so you don't have to learn how NGINX serves files.
Good luck!
I followed the entire tutorial with success in mid-December without this issue.
Currently, my wepback bundle.js file is being served with a content-type of 'text/html' as confirmed in the network tab of chrome devTools. It should be served with 'application/javascript' according to /etc/nginx/mime.types. As strict mime type checking is enabled, this file is not being executed...being that its my webpack bundle...this is a major problem for me, not to mention I expect it would respond the same to requests for all js files.
Has anyone else encountered this or know how to fix it? (I don't want to remove X-Content-Type-Options nosniff from the headers, which is the only solution i've found to this problem.)
/etc/nginx/mime.types