Search code examples
apacheproxypass

apache 2.4 proxy all but not some words


i have a vhost configuration and i will want create 2 proxy, the first proxy pass must redirect all calls to http://localhost:3333, but i want exclude myhost.localhot/myforlder. myfolder is a "Alias"

myhost.localhost

<VirtualHost *:80>        
    ServerAdmin myhost.localhost
    ServerName  myhost.localhost
    ServerAlias www.myhost.localhost

    DocumentRoot C:/wamp/www/myhost/

    DirectoryIndex index.php index.html index.htm
    RewriteEngine On

    #this a alias for get correct file index.html
    #work fine only if i remove next proxyPass
    Alias "/myfolder " "C:/wamp/www/myfolder/theme" 

    #all calls proxy
    ProxyPass / http://localhost:3333/

    <Directory />
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all              
    </Directory>

    # Ricordarsi di creare la directory
    ErrorLog  C:/wamp/logs/myhost.localhost.error.log
    CustomLog C:/wamp/logs/myhost.localhost.access.log combined

</VirtualHost>  

with this configuration if i call http://myhost.localhost/examples work, but if i call myhost.localhot/myforlder the call is in server with port 3333.

how to exclude myfolder from proxyPass directive?


Solution

  • You can exclude paths from mod_proxy in apache adding an exclamation mark (!) at the end.

    ProxyPass /my/excluded/path !
    

    This line has to be added before:

    #all calls proxy
    ProxyPass / http://localhost:3333/