0

Express server fails to load css file after going to any page other than home page. If I go back to the home page and refresh, then every other page has its css correct again. Once the css is wrong, every page is wrong after that. I've been through like 15 different answers already and nothing is working. Website is vessale.com

I believe my routes are correct, and yes since it is on a centos server I have to use /var/www/vessale.com

here is the server code:

app.use(express.static('/var/www/vessale.com' + '/client/build'));
    app.use(express.static('/var/www/vessale.com' + '/client/public'));
    app.use(express.static('/var/www/vessale.com' + '/client/src'));
    app.use(express.static('/var/www/vessale.com/uploads'));
    app.use(express.static('/var/www/vessale.com/client/src/App.css'));
    app.use(express.static('/var/www/vessale.com/client/src/styles.css'));

app.get('*', (req, res) => {
        res.sendFile(path.resolve('/var/www/vessale.com', 'client', 'build', 'index.html'));
    });

I'm aware I don't need all of the static files. That's purely for debugging this issue and I never removed them.

and the /public/index.html

<link rel="stylesheet" type="text/css" href="../src/App.css" >
<link rel="stylesheet" type="text/css" href="../src/styles.css" >
<link  rel="stylesheet" type="text/css" href="../src/styles.scss">

I'm also receiving this error for all three css files

Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://vessale.com/src/styles.css".
pgSystemTester
  • 8,979
  • 2
  • 23
  • 49
KeatonBenning
  • 124
  • 1
  • 1
  • 9
  • Does this answer your question? [Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)](https://stackoverflow.com/questions/22631158/resource-interpreted-as-stylesheet-but-transferred-with-mime-type-text-html-see) – zfrisch Dec 23 '19 at 20:51
  • no those are all them same "fixes" that ive tried already – KeatonBenning Dec 23 '19 at 21:08

0 Answers0