Gogs.io running on subdomain with port - apache

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>

Related

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/

Apache listen and redirect to a different port

I know this has been asked before, I used the highest rated question as a baseline, but I still can't get it to work.
I'm trying to host a website through an iocage jail in FreeBSD.
In my jail I'm hosting a domain called sub.domain.com. I've managed to get Apache to listen to a different port, 10080. So when I go to sub.domain.com:10080 I can access my website.
I would like to be able to go sub.domain.com and also access my website. As far as I understand, I need to redirect using mod_proxy to allow 80 -> 10080.
In httpd.conf I uncommented mod_proxy and added the following
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.sub.domain.com
ServerAlias sub.domain.com
ProxyPass / http://localhost:10080
ProxyPassReverse / http://localhost:10080
</VirtualHost>
This doesn't work for me, I still have to go to sub.domain.com:10080 to access my website.
Any tips?
EDIT: current config, also doesn't work
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName <jailip>
ServerAlias <jailip>
ProxyPass / http://<jailip>:10080
ProxyPassReverse / http://<jailip>:10080
</VirtualHost>

Apache Reverse Proxy Cookies not working

following scenario:
I have a webservice running on port 81.
I want to use apache(nginx would also be okay) as reverse proxy, running on port 80 and redirecting mail.domain.com to port 81.
This is working so far.. but my webservice is telling me, that i should activate cookies. Without proxy it's working.
I followed a lot of tutorials etc., but none of the tips worked so far.
This is how my virtualhost looks:
<virtualHost *:80>
ProxyPassReverseCookiePath / http://mail.domain.com
ServerName mail.domain.com:81
ProxyPass / http://127.0.0.1:81
ProxyPassReverse / http://127.0.0.1:81
ProxyPassReverseCookiePath http://myPublicIp:81 http://mail.domain.com
</VirtualHost>
If someone has an easier way with nginx doing this, pls also tell me.
Thanks a lot in advance!!
You probably need to do something like this:
<VirtualHost *:80>
ServerName mydomain.com
ProxyPass / http://mail.domain.com:81
ProxyPassReverse / http://mail.domain.com:81
ProxyPassReverseCookieDomain mydomain.com mail.domain.com
</VirtualHost>
In your example, you are using the CookiePath which is modify the path in the cookie and not the domain.

ProxyPass with a port in Apache Virtualhost does not work

I'm using WSO2 API Manager. I have fronted API Manager(tomcat) with an Apache HTTP Server.
For the URL api.abc.xyz.lk a public IP has been assigned. For that public IP a local IP which is 192.168.6.162 has been assigned. I have added a virtual-host to redirect all the http://api.abc.xyz.lk to http://192.168.6.162:9763/store.
What I'm trying to do here is redirect all the http://api.abc.xyz.lk requests to http://192.168.6.162:9763/store.
Below is the virtual-host block I use.
<Virtualhost *:80>
ServerName api.abc.xyz.lk
ServerAlias api.abc.xyz.lk
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://192.168.6.162:9763/store
ProxyPassReverse / http://192.168.6.162:9763/store
</Virtualhost>
The problem is
the URL that works is as below
http://api.abc.xyz.lk:9763/store
But actually what I want is
http://api.abc.xyz.lk
How can I fix this?
you need to modify this proxy pass
ProxyPass /store http://192.168.6.162:9763/store
ProxyPassReverse /store http://192.168.6.162:9763/store
this will do the trick..
make sure to enable the proxy ports in server, you can configure proxy ports by editing "catalina-server.xml" in $UES_HOME/repository/conf/tomcat/catalina-server.xml

Apache host header proxy

I have multiple urls coming into a server. I want to user host headers to redirect the traffic. I am trying to use Apache to redirect these requests to various servers that are inside our firewall. I have gotten part of the solution, but, I seem to be missing something.
For example, http://hostHeader1.mycompany.com should be redirected to a server inside our firewall that handles requests for hostHeader1, and the result should be handed back to the client. http://hostHeader2.mycompany.com should be redirected to a server inside our firewall that handles requests for hostHeader2. Etc.
Right now, I have the following, but, it redirects all traffic to http://hostHeader1Handler/:
<VirtualHost *:*>
ProxyPreserveHost On
ProxyPass / http://hostHeader1Handler/
ProxyPassReverse / http://hostHeader1Handler/
ServerName hostHeader1.mycompany.com
</VirtualHost>
Any help appreciated.
Scott
This is probably your first or your only virtual host. Just add another virtual host before. Then this should be the new default.
NameVirtualHost *:*
<VirtualHost *:*>
ServerName your.default.domain.de
DocumentRoot /var/www/pathToHTML
</VirtualHost>
<VirtualHost *:*>
ProxyPreserveHost On
ProxyPass / http://hostHeader1Handler/
ProxyPassReverse / http://hostHeader1Handler/
ServerName hostHeader1.mycompany.com
</VirtualHost>