Apache proxypass issue with firefox - apache

I've got a wordpress blog running in a docker container, and I'm trying to reverse proxy to it from a virtualhost in the host's apache config. My vhost config looks like this:
<VirtualHost *:80>
ServerName my.vhost.com
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://127.0.0.1:8084/
ProxyPassReverse / http://127.0.0.1:8084/
</VirtualHost>
When I visit it in chrome, it works fine. When I pull it through curl it looks fine. But when I go to the my.vhost.com in firefox it redirects me to the host ip address (no port).
Does anyone know what's going on here?

Related

Apache reverse proxy leading to a blank page

I have a youtrack instance running on port 8080 of my webserver. The domain that is used to access the server is subdomain.maindomain.com
Now I want youtrack to be accessed through subdomain.maindomain.com/youtrack instead of subdomain.maindomain.com:8080.
However, when setting up my reverse proxy config, the url leads to a blank page.
My youtrack.conf looks like the following:
<VirtualHost *:80>
ServerName subdomain.maindomain.com
ProxyPreserveHost On
DocumentRoot /var/www/html
ProxyPass /youtrack/ http://subdomain.maindomain.com:8080/
ProxyPassReverse /youtrack/ http://subdomain.maindomain.com:8080/
</VirtualHost>

Apache reverse proxy infinite loop

I am stuck on an apache configure issue. The website keeps loading. It seems like an infinite redirection issue.
I am setting up a reverse proxy. The purpose is to host two web servers(Wordpress and Flask) on the same machine. I want some requests go to wordpress and some of goes to Flask. My solution is to let Wordpress listening on port 8080 and Flask listening on port 8081. In the setting below, I am trying to redirect all requests to port 8080(I will add flask later). But, it doesn't work. The website keeps loading. Can I get some help?
My setting is:
<VirtualHost *:80>
DocumentRoot /wordpress/wp-content
SSLProxyEngine On
ProxyPreserveHost On
ServerName aa.mcmaster.ca
ProxyRequests off
ProxyPass / http://aas.mcmaster.ca/:8080
ProxyPassReverse / http://aaas.mcmaster.ca/:8080
</VirtualHost>
Thanks!
Use below ProxyPass and test.
ProxyPass / http://aa.mcmaster.ca:8080/
ProxyPassReverse / http://aa.mcmaster.ca:8080/

Forwarding subdomain to a port of localhost using WHM and apache2

In brief, I can access my site using example.com:3000 but I want to access it using sub.example.com.
I am using WHM to manage my server using the example.com domain. I have added a DNS Zone using the WHM control panel for sub.example.com. It works fine and redirects to sub.example.com/cgi-sys/defaultwebpage.cgi.
I also tried to make a reverse proxy using VirtualHost by adding the following lines to the /etc/apache2/conf/httpd.conf file as mentioned in here:
<VirtualHost *:80>
ServerName sub.example.com
ProxyPreserveHost on
ProxyPass / http://localhost:3000/
</VirtualHost>
Then I restarted the Apache server using sudo systemctl restart httpd. However the subdomain still redirects to the sub.example.com/cgi-sys/defaultwebpage.cgi path rather than forwarding to the port:3000. Could you please help me resolve this problem?
It is worth mentioning that the server is using WHM and CPanel (version 84.0.21) on CentOS (version 7.7) as well as Apache (version 2.4.41) and the port:3000 is connected to a docker image (gitea) via docker-compose.
I had the same issue with the same setup and was able to solve it by using this configuration:
<VirtualHost sub.example.com:80>
ServerName sub.example.com
ServerAlias sub.example.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
Adding it to Apache's include directive in WHM:
https://docs.cpanel.net/whm/service-configuration/include-editor/
For SSL port 443 you have to use the IP instead of domain:
<VirtualHost 1.1.1.1:443>

Gogs.io running on subdomain with port

I'm trying to run Gogs.io on an apache webserver along with a standard website, and I'm trying to have Gogs.io used on a subdomain rather than using my standard domain with a port.
Gogs.io runs on port 3000, and I want the url to be
http://gogs.example.net/
Rather than
http://example.net:3000/
Both my public IP with port and example.net:3000 work, but when trying to use gogs.example.net, I always get an AT&T DNS Error Assist page. I'm not sure what I'm doing wrong, as I had it working earlier until I tried to change the name of the subdomain in my apache config, but I changed it back when I started having issues, to no luck.
Here is my Apache config for the page:
<VirtualHost *:80>
ServerName gogs.example.net
ProxyPreserveHost On
ProxyPass / http://example.net:3000/
ProxyPassReverse / http://example.net:3000/
</VirtualHost>
This may be impossible, but any help would be greatly appreciated!
Fixed the issue by adding an A record to my domain
A Record: git -> 111.222.333.444
As well as modified the VirtualHost settings to include the subdomain in the ProxyPass and ProxyPassReverse
<VirtualHost *:80>
ServerName gogs.example.net
ProxyPreserveHost On
ProxyPass / http://git.example.net:3000/
ProxyPassReverse / http://git.example.net:3000/
</VirtualHost>

Using Joomla on Apache behind Apache Reverse Proxy

I have a Joomla Installation on Apache2 (Port 83) running on Ubuntu 16.04 Server.
When I connect to the page from the local network like 192.168.178.14:83 it appears and everything is fine. To access my page from the Internet there is another Server running Apache2, that acts as a Proxy Server. All traffic going trough Port 80 and 443 come to this machine, using the ServerName it decide to which machine the traffic have to be forwarded. That's working fine for about 10 domains and machines.
But when I connect to my Joomla Domain I get a HTML Site without any formatting, graphics and templates. When I forward a Port directly to this machine everything works fine again, using this port to connect.
network topologie
My VirtualHost config on Ubuntu1:
<VirtualHost *:80>
ServerName ksg-events.de
Redirect permanent / https://ksg-events.de/
</VirtualHost>
<VirtualHost *:443>
ServerName ksg-events.de
ProxyPreserveHost On
ProxyRequests Off
ProxyVia Off
ProxyPass / http://192.168.178.14:83/
ProxyPassReverse / http://192.168.178.14:83/
SSLCertificateFile /etc/letsencrypt/live/ksg-events.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ksg-events.de/privkey.pem
</VirtualHost>
Virtual Host config on Ubuntu2:
<VirtualHost *:83>
DocumentRoot /var/www/ksg-events.de/joomla
</VirtualHost>
Thanks for your help!
I find a solution to my problem:
Run Joomla behind Apache reverse proxy (http):
Add ProxyVia full to proxy's VirtualHost config
Using https:
Enable mod_headers on proxy server
Add RequestHeader set X-Forwarded-Proto "https" to proxy's VirtualHost
I hope that can help someone who run into the same problems.