apache2 proxy redirect configuration - apache

This has been asked a bunch of time I realize but I still can't seem to get it working. Here is my situation. I have 2 servers on my network. Server A is public facing which hosts my website. My second server also has apache running with a web application which I would like to access externally. I am not exactly sure how to configure this. My current config looks like this
NameVirtualHost *:2323
<VirtualHost *:2323>
ProxyPass / http://192.168.1.7/ampache
ProxyPassReverse / http://192.168.1.7/ampache
servername slave-1
ProxyPreserveHost On
ProxyRequests Off
</VirtualHost>
So I would like all traffic on https://my_domain.xx:2323 to redirect to 192.168.1.7/ampache
Thank you

I fixed it by doing the following
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass /airsonic http://192.168.1.7:8088/airsonic
ProxyPassReverse /airsonic http://192.168.1.7:8088/airsonic

Related

Apache reverse proxy showing internal IP rather than domain in URL

I have a simple reverse proxy running on a VM passing internet based requests to flask app on another VM.
All seems to work well but the URL is showing my internal IP address rather than my domain. This means the IP is exposed and any subsequest requests cannot be fulfiled.
I feel like a bit of an idiot here as I cannot work out the command to stop this happening.
My conf file looks like this:
<VirtualHost *:80>
ServerName xxx.xxxxxxxxxxx.co.uk
ServerAlias www.xxx.xxxxxxxxxxxxxx.co.uk
ServerAdmin webmaster#xxxxxxxxxxx.co.uk
ErrorLog "/var/log/apache2/xxxxxerror.log"
CustomLog "/var/log/apache2/xxxxxaccess.log" combined
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost off
ProxyPass / http://192.168.1.21:5050/
ProxyPassReverse / http://192.168.1.21:5050/
</VirtualHost>
Can anyone help point out my stupid mistake?
I get this is the URL after I make initial contact: http://192.168.1.21:8051/
Thanks
I have tried everyhting I know but the stupid filter is strong today

Redirect subdomain to subdomain+folder

I've linked a subdomain to my Tomcat app, but I don´t want to put the name of the folder to access. I've done this using Apache as a proxy.
<VirtualHost *:80>
ServerName domain.example.com.pe
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /SSHR http://192.168.10.52:8081/SSHR
ProxyPassReverse /SSHR http://192.168.10.52:8081/SSHR
</VirtualHost>
I've tried with this lines:
ProxyPass / http://192.168.10.52:8081/SSHR/
ProxyPassReverse / http://192.168.10.52:8081/SSHR/
It works, but I've some problems with the Tomcat application. So, what I need is something to redirect from example.domain.com.pe to example.domain.com.pe/SSHR.

Tableau Reverse Proxy Issue

I want to make Tableau (which is on an internal network) accessible on the public network. One of the ways recommended by Tableau Support is a Reverse Proxy.
I have set up the required modules and have the reverse proxy functioning. The login page is available through these settings in httpd given below. However, once I log in and want to open Projects, Views etc. It routes to
http://actualsite.com/#/vieworproject
which should actually be http://actualsite.com/tableauaccess/#/vieworproject.
Here is the httpd configuration:
ProxyPass /tableauaccess/ http://tableauserverexample.com/
ProxyPassReverse /tableauaccess/ http://tableauserverexample.com/
<Location /tableauaccess/>
Order deny,allow
Allow from all
ProxyHTMLURLMap / /tableauaccess/
</Location>
This doesnt solve the main issue with #. I tried
ProxyPass /#/ http://tableauserverexample.com/#/
ProxyPassReverse /#/ http://tableauserverexample.com/#
But it doesnt help. Any suggestions?? Thanks!
We had this same issue recently. Your httpd.conf file is technically correct for mod_proxy, however the url you are attempting to use is not supported by Tableau. You cannot use:
http://actualsite.com/tableauaccess
But rather you must use the format:
http://tableauaccess.actualsite.com
We ended up setting up that sub-domain name and then using a VirtualHost block such as:
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName actualsite.com
DocumentRoot "/path/path2/pathx"
</VirtualHost>
<VirtualHost *:80>
ServerName tableauaccess.actualsite.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://tableauaccess.actualsite.com/
ProxyPassReverse / http://tableauaccess.actualsite.com/
<IfModule mod_cache.c>
CacheDisable *
</IfModule>
RequestHeader set X-Forwarded-Proto "http" #or "https", depending on preference
</VirtualHost>
Be sure to double-check your Tableau server to update the URL format.
Sources:
https://community.tableau.com/thread/198095
https://community.tableau.com/thread/218678
(I don't have enough reputation points to post all of my sources, but thanks to Tableau community, shanemadden at ServerFault, and the Apache documentation.)
edit: forgot trailing slashes

Map apache2 proxy to different ports

I am running apache 2.2 and have a problem to map two different applications (Plex and Owncloud) on port 80. What I want to do is to proxy example/plex to localhost:32400/web (which is the default setting of plex). Also I want to map example/cloud on localhost/owncloud.
What I have tried so far:
<VirtualHost *:80>
ServerName example
<Proxy *>
Order deny,allow
Allow from 192.168.1.0/24
</Proxy>
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /cloud http://127.0.0.1/owncloud/
ProxyPassReverse /cloud http://127.0.0.1/owncloud/
<Location /plex/>
ProxyPass http://127.0.0.1:32400/web/
ProxyPassReverse http://127.0.0.1:32400/web/
</Location>
</VirtualHost>
That works for the cloud => owncloud proxy, but for some reason, whatever I try it doesn´t work for the Plex with port 32400.
I also tried with this instead of the Location block:
ProxyPass /plex http://127.0.0.1:32400/web/
ProxyPassReverse /plex http://127.0.0.1:32400/web/
Thanks in advance!

Two servers with mod_proxy, second server host is local ip and shows /proxy/ in url?

I am having some issues in regards to sessions with a second server I am running on my home network. I do this as a hobby and to develop new applications before they officially go live.
I have a domain pointing to my ip and resolves successfully to server 1, but after configuring mod_proxy to send specific domains to server 2 I am getting some unwanted errors and results. I want the second server to act as a normal server and just go through the first server since my current router can only send port 80 to one local ip and not filter it.
I have a.mydomain.com for my second server and it resolves fine but When I try to use a web application on this second server I get the following error
Warning: You are now accessing Mydomain from http://10.0.1.38/, but Mydomain has been configured to run at this address: http://a.mydomain.com/
Can i fix this?
Also when trying to access phpmyadmin via the a.mydomain.com/phpmyadmin it will change to a.mydomain.com/proxy/phpmyadmin after logging in, can i change this so that it's basically seamless and does not add /proxy.
Here is my vhost config for server 1
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName www.server1domain.net
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ServerName a.mydomain.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://10.0.1.38/
ProxyPassReverse / http://10.0.1.38/
</VirtualHost>
Here is the vhost config for server 2
<VirtualHost *:80>
ServerAdmin admin#mydomain.com
DocumentRoot /var/www/mydomaincom
ServerName a.mydomain.com
</VirtualHost>
I am running Centos 6.4
Alright I finally figured this out, some of the stuff is a little obvious now but this works for anyone else in a similar situation.
So earlier in my http.conf I had this
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# destination directory
ProxyPass /proxy http://10.0.1.38
ProxyPassReverse /proxy http://10.0.1.38
</IfModule>
There seems to be two problems with this, it seems to add the /proxy/ directory and also is wrong since the ip does not have a trailing slash, thus I changed it to this
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</IfModule>
And my http.conf vhost config for the first server looks like this now
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://10.0.1.38/
ServerName a.mydomain.com
</VirtualHost>
If you forget the trailing slash after the ip you will most likely end up with 502 errors: Could not resolve dns
The second servers vhost config looks like this
<VirtualHost *:80>
ServerAdmin admin#mydomain.com
DocumentRoot /var/www/mydomain
ServerName a.mydomain.com
</VirtualHost>
Hope that helps anyone else with similar issues.