Apache reverse proxy

Discussion in 'Installation/Configuration' started by 30uke, Mar 28, 2023.

  1. 30uke

    30uke Active Member HowtoForge Supporter

    Hello,
    I am trying to use ISPConfig (Apache) as a reverse proxy for a docker container.
    I would like to allow access to the download directory to anyone - but restrict to anything else.
    This is to restrict access to the YouTransfer docker container. I don't want everybody to be able to send files. Sending files is to be done from certain IPv4's.
    I did try numerous things like the following (see below).
    Does anyone know how to allow access to "/download" but restrict access to everything else - starting at "/" ?
    Thanks.

    Code:
    ProxyPreserveHost On
    
    <Location /download>
     Require all granted
     ProxyPass http://127.0.0.1:8881/download
     ProxyPassReverse http://127.0.0.1:8881/download
    </Location>
    
    <If "-R '10.0.0.0/8' ||
         -R '192.168.0.0/16' ||
         -R '192.168.0.0/16' ||
         -R '100.64.0.0/10'">
    
        ProxyPass / http://127.0.0.1:8881/
        ProxyPassReverse / http://127.0.0.1:8881/
    
    </If>
     
  2. 30uke

    30uke Active Member HowtoForge Supporter

    This is solved.
    Code:
    ProxyPreserveHost On
    
    <Location /upload>
    <RequireAny>
     Require all denied
     Require ip 10.0.0.0/8
     Require ip 172.16.0.0/12
     Require ip 192.168.0.0/16
     Require ip 100.64.0.0/10
    </RequireAny>
    </Location>
    
     ProxyPass / http://127.0.0.1:8881/
     ProxyPassReverse / http://127.0.0.1:8881/
     
    Alter Ego, ahrasis and till like this.

Share This Page