balancer-manager not accessible - apache2

Whenever I try to access /balancer-manager in the browser, I get a 404 from the connected Tomcat cluster. Any idea what is wrong here?
Environment: Apache/2.2.10 (Linux/SUSE)
<VirtualHost *:443>
ProxyPass /balancer-manager !
ProxyPass / balancer://myalfresco-cluster/ nocanon
ProxyPassReverse / balancer://myalfresco-cluster/
<Proxy balancer://myalfresco-cluster>
BalancerMember ajp://server1:8009 route=jvm1
BalancerMember ajp://server2:8009 route=jvm2
ProxySet stickysession=JSESSIONID
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Allow from all
</Location>
<Location />
[cluster config]
</Location>
</VirtualHost>

There can be two issue.
You are somehow blocked by your .htaccess.
Check your Document Root .htaccess file.
Add this line "RewriteCond %{REQUEST_URI} !=/balancer-manager" without quote if the rewrite engine is on.
Another problem that I did not face but people has reported is your wild card virtual host tag.
Replace the wildcard with actual ip.
I felt obliged to answer this question since I wasted much time trying to find a solution to the problem and I landed on your question quite often through google but without answer.

Related

setup apache reverse proxy from localhost to domain.com/etherpad

Good evening,
I am trying to set up my apache2 reverse proxy
(following https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy)
for etherpad lite
(following https://www.howtoforge.com/tutorial/ubuntu-etherpad-editor-server-installation/, except for the nginx part).
I use http->ssl redirection. Since I use letsencrypt I can only access domain.com and not etherpad.domain.com (at least firefox won't let me and I want to avoid changing that certificate each time I add a new site). So I would like to access my etherpad just as I do access my other sites: domain.com/etherpad. However I always get a 404 trying to get to the site. Looking at a working example, in my nextcloud.conf file I have a line saying:
Alias /nextcloud /local/path/to/nextcloud
However the etherpad reverse proxy virtual host file looks entirely different, the key difference is etherpad not having a local folder but only a mysql database. (Please correct me if this is wrong)
So I tried changing the ssl example from the second link to the following, but it does not work. Please understand that I changed domain name and some internal paths, but "apache2ctl configtest" succeeds and the service is running without error.
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName randomisedDomain.com/etherpad
# SSL configuration
SSLEngine on
# If you hold wildcard certificates for your domain the next two lines are not necessary.
SSLCertificateFile "/working/path/to/fullchain.pem"
SSLCertificateKeyFile "/working/path/to/privkey.pem"
ProxyVia On
ProxyRequests Off
ProxyPreserveHost on
<Location />
AuthType Basic
AuthName "Welcome to the randomisedDomain.com Etherpad"
AuthUserFile /working/path/to/etherpad.passwd
#AuthGroupFile /path/to/svn.group
Require user etherpad
ProxyPass http://localhost:9001/ retry=0 timeout=30
ProxyPassReverse http://localhost:9001/
</Location>
<Location /socket.io>
# This is needed to handle the websocket transport through the proxy, since
# etherpad does not use a specific sub-folder, such as /ws/ to handle this kind of traffic.
# Taken from https://github.com/ether/etherpad-lite/issues/2318#issuecomment-63548542
# Thanks to beaugunderson for the semantics
RewriteEngine On
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:9001/socket.io/$1 [P,L]
ProxyPass http://localhost:9001/socket.io retry=0 timeout=30
ProxyPassReverse http://localhost:9001/socket.io
</Location>
<Proxy *>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Proxy>
</VirtualHost>
Any help for rerouting the localhost domain to randomisedDomain.com/etherpad is greatly appreciated !
Best regards
MAPster

Apache2 Virtual Host 503 error

Here is my apache2 virtual host config -
<VirtualHost *:80>
ServerName A.B.com
ProxyPreserveHost Off
ProxyPass / http://<ServerIP>:<appPort>/<app>/ timeout=3600 Keepalive=On
ProxyPassReverse / http://<ServerIP>:<appPort>/<app>/
ProxyTimeout 3600
</VirtualHost>
<Location "/">
Order allow,deny
Allow from all
</Location>
I have a route 53 entry for A.B.com pointing to this machine (the one with apache2)
I have ran a2ensite.. I am getting a 503 service unavailable on hitting A.B.com
However, A.B.com:appPort/app is working..
This definitely means I am missing something in apache2 configuration.. Can anyone point me out?
ProxyPreserveHost Off
should be on, and not need to mention http://, but in route you can mention http://.
further please check and paste error logs.

Access Geoserver From Internet Ubuntu Server 14.04.1

i'm triying to getup geoserver on IBM Server with Ubuntu Server 14.04.1, i have try making a file in /etc/apache2/sites-available/geoserver.conf and the information in it was:
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver "http://localhost:8080/geoserver"
ProxyPassReverse /geoserver "http://localhost:8080/geoserver"
I access to my server via a subdomain in NO-IP, but a i can't make it work the geoserver, like this; my.subdomain.com/geoserver
A will give any information you need, i really need some help with this.
Thanks.
Well after a lot of research and try lot of things, I understood where I have to put this lines, to set up ProxyPass for GeoServer public data access:
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver "http://localhost:8080/geoserver"
ProxyPassReverse /geoserver "http://localhost:8080/geoserver"
In almost every tutorial that I read, they all explain how to access via internet to GeoServer, using httpd sever, where you have to add the lines of ProxyPass in the archive httpd.conf, in the route:
/etc/httpd/conf/httpd.conf
But since I'm using apache2 server instead of the httpd server, the code to use ProxyPass must be put in in the file 000-default.conf and the route is:
/etc/apache2/sites-avaible/000-default.conf
The code have to be between the labels:
<VirtualHost *:80>
"some code and comments"
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver "http://localhost:8080/geoserver"
ProxyPassReverse /geoserver "http://localhost:8080/geoserver"
</VirtualHost>
Hope this helps.
Any errors you see from me feel free to comment.
Greetings to all.

Reverse proxy with websocket mod_proxy_wstunnel

I have a problem with the web sockets and my reverse proxy Apache, I have upgraded in latest release 2.4.5 and loaded the module mod_proxy_wstunnel.
The httpd.conf :
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName www.toto.fr
ServerAlias toto.fr
ProxyPass /my_app http://1X.X.X.1:8080/my_app
ProxyPassReverse /web_pmr http://1X.X.X.1:8080/my_app
ProxyPassReverseCookiePath /my_app /
ProxyPassReverseCookieDomain localhost my_app
ProxyRequests off
ProxyTimeout 15
#WEBSOCKETS
ProxyPass /my_app/BasicWebsocketServlet ws://1X.X.X.1:8080/my_app/BasicWebsocketServlet retry=0
ProxyPassReverse /my_app/BasicWebsocketServlet ws://1X.X.X.1:8080/web_pmr/BasicWebsocketServlet retry=0
ErrorLog "logs/my_app_error.log"
LogLevel debug
CustomLog "logs/my_app_access.log" combined
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
When I test in my local URL, websockets are working but with the reverse proxy Apache, there is no trace in Tomcat logs.
This line:
ProxyPass /my_app/BasicWebsocketServlet ws://1X.X.X.1:8080/my_app/BasicWebsocketServlet retry=0
needs to come before this one:
ProxyPass /my_app http://1X.X.X.1:8080/my_app
Explanation (from https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass):
Ordering ProxyPass Directives
The configured ProxyPass and ProxyPassMatch rules are checked in the order of configuration. The first rule that matches wins. So usually you should sort conflicting ProxyPass rules starting with the longest URLs first. Otherwise later rules for longer URLS will be hidden by any earlier rule which uses a leading substring of the URL. Note that there is some relation with worker sharing. In contrast, only one ProxyPass directive can be placed in a Location block, and the most specific location will take precedence.
For the same reasons exclusions must come before the general ProxyPass directives.

How Can I Proxy To Multiple Application Running in Tomcat via mod_proxy

I have 2 web applications running under Tomcat6. Currently, I can access one of them via mod_proxy with the following config...
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin email#email.com
ServerName staging.domain.com
ProxyPass /app1 http://localhost:8080/app1
ProxyPassReverse /app1 http://localhost:8080/app1
</VirtualHost>
Now, I can access app1 via http://staging.domain.com/app1. I also want to be able to access app2 the same way: http://staging.domain.com/app2. I configured a second VirtualHost however, only the first one works. Is this even possible, to proxy 2 web apps under a single domain? If so, any hints, tips, tricks would be greatly appreciated.
Ah, you're already pretty much doing it: just add extra ProxyPass/ProxyPassReverse statements.
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin email#email.com
ServerName staging.domain.com
ProxyPass /app1 http://localhost:8080/app1
ProxyPassReverse /app1 http://localhost:8080/app1
ProxyPass /app2 http://localhost:8080/app2
ProxyPassReverse /app2 http://localhost:8080/app2
ProxyPass /app3 http://localhost:8080/app3
ProxyPassReverse /app3 http://localhost:8080/app3
</VirtualHost>

Resources