I have multiple tools running on different ports on the same machine. Jenkins, gitea, etc. I have a CNAME setup for each. jenkins.foo.bar, gitea.foo.bar, etc. I'm trying to set it up so when I go to jenkins.foo.bar it actually loads foo.bar:8080 and gitea.foo.bar loads foo.bar:3000. So far I've tried to setup a proxy pass and reverse proxy pass with httpd 2.4.6.
<VirtualHost gitea.foo.bar:80>
ServerName gitea.foo.bar
ServerAlias gitea.foo.bar gitea.foo
ProxyPreserveHost On
ProxyPass / foo.bar:3000/
ReverseProxyPass / foo.bar:3000/
</VirtualHost>
EDIT: The actual question... Originally I was get Error 403 unavailable. Now when I go to gitea.foo it's redirected to foo.bar:3000 correctly. gitea.foo.bar loads foo.bar's index and is not caught by the proxy.
Part 2: Is it possible to keep gitea.foo in the address bar and not display the redirected address?
=========================
EDIT (The solution): Big thanks to @GeraldSchneider
SeLinux was blocking proxy pass. Note this took 20 minutes to complete
setsebool -P httpd_can_network_connect 1
Move ssl.conf out of the way since it was listening on 443.
mv /etc/httpd/conf.d/ssl.conf /etc/hhtpd/conf.d/ssl.conf.bak
Add the following to /etc/httpd/conf/httpd.conf
Listen 443 https
<VirtualHost *:80>
ServerName gitea.foo.bar
Redirect / httpd://gitea.foo.bar:3000
</VirtualHost>
<VirtualHost _default_:443>
ServerName gitea.foo.bar
SSLEngine On
SSlProxyEngine On
SSLCertificateFile /etc/PATH/TO/gitea.foo.bar.pem
SSLCertificateKeyFIle /etc/PATH/TO/gitea.foo.bar.key
ProxyPass / https://gitea.foo.bar:3000/
ProxyPassReverse / https://gitea.foo.bar:3000/
</VirtualHost>
Edit gitea config /etc/gitea/app.ini
[server]
PROTOCOL = https
ROOT_URL = https://gitea.foo.bar
CERT_FILE = /etc/PATH/TO/gitea.foo.bar.pem
KEY_FILE = /etc/PATH/TO/gitea.foo.bar.key