openHAB behind apache reverse proxy - is webroot configurable?

I’m not an openHAB user yet but considering to become one.
Already tried Home Assistant and it was mosty ok, but one awful feature makes me to keep looking for alternatives.
I’d like to setup the server on my home machine on which I already have some web applications.
And I don’t want to use separate subdomain for that.

Is it possible to have webroot of openHAB configured to something else than “/”?

What I want to achieve is to host on my machine via apache serveral apps like this:

www. mydomain. com/my_old application
www. mydomain. com/my_other_old_application
www. mydomain. com/openHAB

With Home Assistant this is not possible and their architects say it will never be. Wondering if openHAB supports that.

I don’t really see how this relates to OH since this more a question of correctly configuring your reverse proxy. I think you should have a look at the Apache mod_alias Module:

Yes, it theory it shall not be related to OH (or any other software).
Yet some services do not support that.
HA is just one of few I know - hence the question.

From your answer I get that OH does not have such problem so I give it a try :wink:

Depending on what you want to do this can be done pretty easily in combination with Docker. Running via Docker means OpenHAB is ‘unaware’ that it is not running as the ‘main’ webserver, avoids conflicts with Java versions etc.

I’m running OpenHAB via Docker (link to Docker Hub), using the ‘Docker compose yml’ method as described there. This allows you to configure Docker to run OpenHAB on any random port, and with Apache (or in my case I use nginx) you can then configure that to use that docker server (in my case, I use, but whatever you like will work) as @DrRSatzteil mentions.

This should also work for Home Assistant by the way should you want to go back to that, looks like they support that too actually. The ‘architects’ are correct in a way: using Docker, also Home Assistant will never ‘know’ it is not the main server, but you can still use Apache/nginx + Docker Container to have it peacefully coexist with anything else you have running.

Start with openHABian. It’s the OS / companion bundle for openHAB and among many things provides an option to fully setup a reverse proxy, too.
NGINX that is but it does the trick, you don’t even have to work out the configuration yourself.

Here’s an example of a working apache config for a separate openahb subdomain

I can also recommend the use of Jason Wilders Nginx proxy when you’re running a docker setup:

Have a look at the „Per-VIRTUAL_HOST location configuration„ chapter of the documentation. I use this feature to extend hosted applications with self-written services that are actually run in different docker containers. Of course you do not need the nginx-proxy container to do this, these are all just standard nginx features.

I think the issue is not with the forwarding in nginx, but with the links within the pages rendered by openhab, which may include path that assumes openhab in server root directory, thus these links then will not work. There also seems to be open feature request on this:
Did anyone actually manage to run openhab with a path prefix? I failed, though did not put too much effort into this…