"No protocol handler valid for the URL" with httpd mod_proxy_balancer
Solution 1
facepalm
It turns out that I was missing a trailing slash on my ProxyPass
directive:
ProxyPass "/site/" "balancer://cms"
should have been:
ProxyPass "/site/" "balancer://cms/"
(Note the trailing slash before the close-quote.)
That literally fixed everything.
I'm happy to delete this question and answer if folks want to close it as "simple typographical error", but I'll leave it for now. If I get some up votes on this answer, I'll remove this note and consider it a public service for anyone who might make the same mistake.
Solution 2
In my case, I needed proxy_ajp
module.
a2enmod proxy proxy_http proxy_ajp
Solution 3
Same as kujiy i had to add the mod_ajp
.
I am using apache4.
My log showed messages as follows:
No protocol handler was valid for the URL /jira.
If you are using a DSO version of mod_proxy,
make sure the proxy submodules are included in
the configuration using LoadModule
so I added ( I mean uncommented) the following line to my httpd.conf:
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
saved, and the restarted the apache server.
Related videos on Youtube
Christopher Schultz
Updated on September 18, 2022Comments
-
Christopher Schultz almost 2 years
I'm trying to set up failover for a reverse-proxied server with a localhost static copy of resources that would usually be served by a content management system. I've used
wget
to grab a static copy of the dynamic site for failover purposes.I've tried to use a configuration similar to Fall-back location for Apache's ProxyPass directive? to get things started, and it's a fairly straightforward, but I'm getting the error in the title.
Here's my (sanitized) proxy configuration:
DocumentRoot /var/www/www.example.com/htdocs ProxyRequests Off ProxyPreserveHost On ProxyPass "/site/" "balancer://cms" ProxyPassReverse "/site/" "balancer://cms" ProxyPassReverse "/site/" "http://ip-10-1-1-229.ec2.internal/site/" <Proxy "balancer://cms"> #BalancerMember "http://ip-10-1-1-229.ec2.internal/site/" loadfactor=1 # For localhost services, a backup of the CMS's site BalancerMember "http://127.0.0.1/site-backup/www.example.com/site/" loadfactor=10 status=+H </Proxy> <Directory "/var/www/www.example.com/htdocs/site-backup"> Order allow,deny Allow from all Options Indexes FollowSymlinks DirectoryIndex index.html </Directory>
(Here, I've commented-out the balancer member that goes to the real CMS system -- that part is working just fine -- so that I can test the local, static copy.)
There is an
index.html
file in/var/www/www.example.com/site-backup/www.example.com/
and it does get loaded when I try to hithttp://www.example.com/site/
, but none of the page's other resources (CSS, images, etc.) get loaded. They have URLs in the page like:I have a file,
foo.png
at this location:/var/www/www.example.com/htdocs/site-backup/www.example.com/site/sites/default/files/foo.png
But when that image is loaded by the browser, I get a
500 Internal Server Error
response and I see this in httpd's error log:[proxy:warn] [pid 3182:tid 2838395712] [client 71.127.40.115:38208] AH01144: No protocol handler was valid for the URL /site/site/sites/default/files/foo.png. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: http://test.example.com/site/
I noticed that the URL shown in the error message has an extra
/site/
in the URL, so I figured it was getting doubled because I'm trying to serve a URL space including/site/
from a directory containing/site/
andwget
is probably not perfect right now, so I created a symlink from/var/www/www.example.com/site-backups/www.example.com/site/site/sites
->
/var/www.www.example.com/site-backups/www.example.com/site/sites
. That ought to have fixed any foolishness due to URL confusion.But that didn't seem to fix anything;
mod_proxy
is still complaining about the protocol.mod_proxy_http
is definitely enabled, as the normalProxyPass
directive to the CMS is working as expected (when enabled).I'm sure this is a fairly simple thing I'm missing, but I can't seem to figure it out. Any help would be greatly appreciated.
-
Yogesh Devi over 7 yearsA comment to kujiy's reponse could have sufficed , or an upvote... but alas my reputation ( or lack of it ... does not allow me to do that --- so thanks @kujiy
-
Geremia over 7 yearswhy would a trailing slash matter?
-
Christopher Schultz over 7 years@Geremia The trailing slash is necessary on the origin-URL because the proxied URL has a trailing slash.
-
Christopher Schultz over 7 yearsEnabling
mod_proxy_ajp
is not useful for this particular application. You are answering a question which was not asked here. -
kujiy over 7 yearsYes, I know my answer was not just exactly for this question. Though sometimes we have to come to these similar questions when we google with the same error message. I don't know stackoverflow allows it or not but I believe it helps some people and me. Sorry. @ChristopherSchultz
-
kujiy over 7 yearsYour welcome @YogeshDevi. This is a problem about google and stackoverflow. If I and Devi make a new question and answer for proxy_ajp, it won't hit on google and this question will hit for the error message.
-
RTK over 6 years@kujiy
a2enmod proxy_http
helped me with the same problem, thx :) -
Chris Giddings about 6 yearsThe slash is all I required. Is there a technical reason to quote the URL pattern and the balancer reference?
-
Christopher Schultz about 6 years@ChrisGiddings I tend to quote everything that might possibly contain a space. I also tend to script lots of things, so it's very possible NOT quoting something won't be obvious when adding a space to a value that might end up in there.
-
Chris Giddings about 6 years@ChristopherSchultz That's entirely reasonable. I also tend to script quite a bit, but I've never done so within a balancer reference. It just caught my attention. :)
-
Abhishek Prabhat over 4 yearsa2enmod proxy proxy_http helped me.