Search code examples
node.jsexpressibm-cloud

Website images don't load, but other static files do


I have a problem that confuses me since hours. I have a small website with a chat application on an express server. On localhost there is no problem at all. Images load normally, css and js files ok, everything perfect.

But as soon as I push the code online into IBM-Cloud (ex-bluemix), images give me a 404. The rest of the static files do get served though, and the application otherwise works normally.

The file structure looks like this:

--client
    --resources
        logo.png
    --scripts
        loginScreen.js
    --stylesheets
        stylesheet1.css
    index.html
--server
    app.js

The server starts in app.js and in the code I've put this before initializing the server:

expressApp.use(express.static(path.join(__dirname, "..", "client")));

I had some small problems with filename casing which I detected after building a docker container, but this is resolved and shouldn't be the problem. Any ideas?


Solution

  • The Simple Cloud Foundation Toolchain was registering my commits in github successfully and triggered the auto-build and deploy.

    All code changes were pulled normally by the bluemix server. But the filename changes not. So for example the file called Logo.png was renamed to logo.png locally. This change was pushed normally into github. But logging into the bluemix server with ssh revealed that the filename there remained Logo.png.

    I had to change the filenames manually by $ mv and now it works.