I have a web application, which is served by a standalone app. Sometimes the JVM it's running in crashes, but most often, I need to take it down to deploy a new version or to update the system. For various reasons it has to serve HTTP/HTTPS requests directly, so I can't use a proxy in front of it.
Is there some way to have the system itself (Ubuntu Linux) answer HTTP requests when the app is down? Or, in other words, is there some way to configure the server so that whenever the normal response would be "connection refused", it would serve some static (503) page instead? If possible, it would be great if it could handle HTTPS as well.