Search code examples
node.jsexpressreactjsopenshifthttp-status-code-503

Getting 503 status code when index.html tries to load css and scripts [nodejs + express]


I'm using static middleware to serve stylesheets and scripts

app.use(express.static(path.join(__dirname, 'public')));

Everything works on localhost, but once I deploy the app to openshift I get 503 code for each static file the page tries to load.
If I open another browser tab and directly past the URL of one of those files I actually get the file.

P.S.: I am using express-react-views as a view engine.


Solution

  • Basically, I'm using express-react-views as a view engine and it includes Babel.js which uses cache for transpilation optimization. The problem is that it tries to write the cache files in a directory that requires higher permission. To solve I disabled the cache.

    process.env.BABEL_DISABLE_CACHE = 1;
    

    I hope this can help other people having the same issue.