I started slowly pulling my hair out. I cannot believe such a simple thing causes me this much headache. What I'm basically trying to achieve is to make http://maris-minipc/portainer to point to http://maris-minipc:9000. That's it.
I have following setup:
- Docker container with self-hosted Portainer and exposed on port 9000.
- Apache web server available system-wide and used to host other things.
- Pihole with incorporated DNS server (dnsmasq).
The URL http://maris-minipc is network-wide accessible, as I'm using it normally to access stuff hosted on previously mentioned apache web server (meaning my DNS server is working correctly). Then, I just created a new apache config file with the following content:
<VirtualHost *:80>
ServerName maris-minipc
ProxyPreserveHost On
ProxyPass /portainer http://maris-minipc:9000/
ProxyPassReverse /portainer http://maris-minipc:9000/
ErrorLog test/error.log
CustomLog test/access.log combined
</VirtualHost>
Whenever I access the URL http://maris-minipc/portainer I get 400: Bad Request
for some reason. This at least means that the proxy is running, otherwise I would get
Not Found
The requested URL was not found on this server.
Apache/2.4.55 (Ubuntu) Server at maris-minipc Port 80
I also tried redirecting the URL to an external website and it worked.
In case you are interested into my /etc/hosts file:
127.0.0.1 localhost
127.0.1.1 Maris-MiniPC
What could be blocking the route in my local network? Is there something, specific I need to setup inside docker, because I couldn't find anything?
EDIT1: Acquired proxy debug log
[Mon Sep 11 18:44:38.419683 2023] [proxy:trace2] [pid 2059141] mod_proxy.c(884): [client 10.10.10.3:51982] AH03461: attempting to match URI path '/ha' against prefix '/ha' for proxying
[Mon Sep 11 18:44:38.419803 2023] [proxy:trace1] [pid 2059141] mod_proxy.c(1001): [client 10.10.10.3:51982] AH03464: URI path '/ha' matches proxy handler 'proxy:http://maris-minipc:8123/'
[Mon Sep 11 18:44:38.419956 2023] [proxy:trace2] [pid 2059141] proxy_util.c(2340): [client 10.10.10.3:51982] http: found worker http://maris-minipc:8123/ for http://maris-minipc:8123/
[Mon Sep 11 18:44:38.419983 2023] [proxy:debug] [pid 2059141] mod_proxy.c(1506): [client 10.10.10.3:51982] AH01143: Running scheme http handler (attempt 0)
[Mon Sep 11 18:44:38.420000 2023] [proxy:debug] [pid 2059141] proxy_util.c(2538): AH00942: http: has acquired connection for (maris-minipc:8123)
[Mon Sep 11 18:44:38.420086 2023] [proxy:debug] [pid 2059141] proxy_util.c(2596): [client 10.10.10.3:51982] AH00944: connecting http://maris-minipc:8123/ to maris-minipc:8123
[Mon Sep 11 18:44:38.420460 2023] [proxy:debug] [pid 2059141] proxy_util.c(2819): [client 10.10.10.3:51982] AH00947: connected / to maris-minipc:8123
[Mon Sep 11 18:44:38.420599 2023] [proxy:trace2] [pid 2059141] proxy_util.c(3257): http: fam 2 socket created to connect to maris-minipc:8123
[Mon Sep 11 18:44:38.420830 2023] [proxy:debug] [pid 2059141] proxy_util.c(3291): AH02824: http: connection established with 127.0.1.1:8123 (maris-minipc:8123)
[Mon Sep 11 18:44:38.420909 2023] [proxy:debug] [pid 2059141] proxy_util.c(3480): AH00962: http: connection complete to 127.0.1.1:8123 (maris-minipc)
[Mon Sep 11 18:44:38.426673 2023] [proxy:debug] [pid 2059141] proxy_util.c(2554): AH00943: http: has released connection for (maris-minipc:8123)