I'm trying to set up a basic virtual host to proxy all requests to test.local to a WEBrick server I have running on while keeping all requests to localhost going to my static files in /var/www. I'm running Ubuntu 10.04.

I have libapache2-mod-proxy-html installed and I have the module enabled with a2enmod proxy. I also have my virtual host enabled. However, whenever I go to test.local I always get a cryptic 500 server error and all my logs are telling me is:

[Thu Mar 03 01:43:10 2011] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

Here's my virtual host:

<VirtualHost test.local:80>
    LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
    ServerAdmin webmaster@localhost
    ServerName test.local
    ProxyPreserveHost On

    # prevents this folder from being proxied
    ProxyPass /static !

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

    <Proxy *>
        Order allow,deny
        Allow from all
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

and here's my settings for mod_proxy:

<IfModule mod_proxy.c>
        #turning ProxyRequests on and allowing proxying from all may allow
        #spammers to use your proxy to send email.

        ProxyRequests Off

        <Proxy *>
        # default settings
                #AddDefaultCharset off
                #Order deny,allow
                #Deny from all
                ##Allow from .example.com

        AddDefaultCharset off
        Order allow,deny
        Allow from all

        # Enable/disable the handling of HTTP/1.1 "Via:" headers.
        # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
        # Set to one of: Off | On | Full | Block

        ProxyVia On

Does anybody know what I'm doing wrong? Thanks

2 Answers 2


Looks like you're not loading the mod_proxy_http module (which is needed to proxy to HTTP servers). I don't have Ubuntu 10.04 in front of me, but IIRC it's something like:

sudo a2enmod proxy_http
  • I have both proxy_http and proxy_html enabled and restarted apache but now I'm getting a 503 error. Here's the logs from right after I restarted with 3 refreshes on firefox: Mar 3, 2011 at 20:28
  • [Thu Mar 03 12:25:29 2011] [error] (111)Connection refused: proxy: HTTP: attempt to connect to (localhost) failed [Thu Mar 03 12:25:29 2011] [error] ap_proxy_connect_backend disabling worker for (localhost) [Thu Mar 03 12:26:05 2011] [error] proxy: HTTP: disabled connection for (localhost) [Thu Mar 03 12:26:10 2011] [error] proxy: HTTP: disabled connection for (localhost) Mar 3, 2011 at 20:28
  • Actually, all of a sudden it started working. Thank you. Mar 3, 2011 at 20:41
  • 1
    In my case, proxy_ajp was missing (we use AJP to connect with tomcat). Jun 16, 2014 at 11:54
  • u just saved my life @ThomasFerrisNicolaisen
    – Pras
    Jun 9, 2016 at 5:38

The above answer didn't help for me as I was receiving the same error as in the author's comment in the selected answer. However, I did find the following post and change which solved my problem:

sudo /usr/sbin/setsebool -P httpd_can_network_connect 1

Source: http://allscm.com/archives/apache2-proxy-disabled-connection-on-localhost.html

  • CentOS / RedHat / Fedora has SELinux. Ubuntu does not. Jul 6, 2015 at 18:12
  • Oh my, excellent point. I missed the [ubuntu] tag on the original post, only now seeing that years later. I was on CentOS 6 at the time I ran into this problem, thus my inaccurate answer here. Sep 17, 2015 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.