Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Healthcheck for protected custom Node apps


  • Hi All-

    I have a custom Node app that runs smoothly and passes the Healthcheck when the homepage is not protected.

    However, if I try to protect the whole app including the homepage, I get "Not Responding" in my dashboard. I saw that for LAMP apps there is an easy fix here by editing the .htaccess file -- but how do I fix this for a Node app?

    Sincere thanks,

    Phil

  • Staff

    This would highly depend on the kind of node app. For LAMP there is a http server (apache) running, which serves up a folder tree. This may or may not be the case for a nodejs server, but it is part of the app code itself and there is no such universal concept of htaccess like for apache.

    Which nodejs app are you referring to?

  • Staff

    @pdubs For custom apps, simply add a special route in your nodejs app like /cloudron_healthcheck and make it return a http status code 200. Then fixup the healthCheckPath of your app's CloudronManifest.json.


  • I can do things like this but there's an app I'm editing right now for Cloudron that has a token capability and no place for a "whitelist" URL so I have to code one - there are a few web apps that are allowed to be "tokened" shut. It would be nice to be able to provide within the "health path" /?token=abcdefg in the Cloudron.manifest just like I would the URL when accessing it...does that work already or would those be considered invalid characters? This is for custom development, of course. It would speed up the process of porting over new changes that open source projects have while still maintaining instant security.

  • Staff

    @Lonk mm, given the CloudronManifest.json is checked into a git repo, would it not be dangerous to put the token in the health path? But otherwise, ?token=xx should indeed work already.


  • @girish Yes yes, this would only be for development purposes (since placing the token in CloudronManifest would, of course, be silly).

    This would be just to pass the healthcheck so I don't expose anything while developing on a public domain.

    Thanks for letting me know it'll work, it'll help with an app I'm porting.