4

I'm trying to set-up a password protected development version of a clients web site (Plone CMS driven).

The live site serves on port 7373, and is mapped to the public www port 80.

The 'dev' site serves on port 8383, and is mapped to port 8111.

I don't currently have access to the clients DNS records, so I can't set up a sub domain, but IP and different port numbers are fine.

However, I can't work out how to password protect the development site, whilst still serving the live site. I'm especially flummoxed by the protection settings seeming to be for folders only, not sites?

Below is the best guest I have (based on my rather lacking apache-foo), but this only serves the live site, not the dev site, or fire the password!

<VirtualHost *:80>
 ServerAlias www.site.com

ProxyRequests Off
 <Proxy *>
   Order deny,allow
   Allow from all
 </Proxy>

  ProxyPreserveHost On
  ProxyPass / http://localhost:7373/VirtualHostBase/http/site.com:80/plonesite/VirtualHostRoot/
  ProxyPassReverse / http://localhost:7373/VirtualHostBase/http/site.com:80/plonesite/VirtualHostRoot/


</VirtualHost>

<VirtualHost 123.456.789.123:8111>

<Location /plonesitetest/>
  AuthType Basic
  AuthName "Dev Server"
  AuthUserFile "/home/admin/.htpasswd"
  Require valid-user
</Location>


ProxyRequests Off
 <Proxy *>
   Order deny,allow
   Allow from all
 </Proxy>

  ProxyPreserveHost On
  ProxyPass / http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/
  ProxyPassReverse / http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/


</VirtualHost>

4 Answers 4

3

Your ProxyPass lines look a little confusing, having port numbers halfway through the URL. Is that really how the plone server is setup to handle the incoming request (port numbers in the file/dir names)?

The proxy stuff is very order specific. From a quick check of the apache docs, it looks like the ProxyPass lines are probably kicking in before the Location lines, which may be bypassing the authentication stuff. How about something like this:

<Location /plonesitetest/>
  AuthType Basic
  AuthName "Dev Server"
  AuthUserFile "/home/admin/.htpasswd"
  Require valid-user
  ProxyPass http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/
  ProxyPassReverse http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/
</Location>

This will proxy requests for http://123.456.789.123:8111/plonesitetest/ onto the plone site.

4
Respost:
<VirtualHost *:8282>
    ServerName www.gpscoder.com
    ProxyPass / http://www.gpscoder.com:8080/
    ProxyPassReverse / www.gpscoder.com:8080/
    ProxyPreserveHost on
    <Proxy *>
        AuthType Basic
        AuthName "Dev Server"
        AuthUserFile "/var/www/xxxxxxx/.htpasswd"
        Require valid-user
    </Proxy>
</VirtualHost>
1
  • I had the same kind of problem, and the <Proxy *>...</Proxy> solved my issue. Don't want to write a huge comment here, so check this out for details:hastebin.com/raw/ogusasimux Thanks to Jorge Sales :)
    – Souvik
    Mar 27, 2017 at 15:55
0

Live site

<VirtualHost *:80>
    ServerName siteurl.com
    DocumentRoot "/path/to/live/site"
    ProxyPreserveHost On
    ProxyRequests Off
    Proxypass / http://siteurl.com:7373/
    ProxypassReverse / http://siteurl.com:7373/
</VirtualHost>

Then for your dev site

<VirtualHost *:8111>
    ServerName siteurl.com
    DocumentRoot "/path/to/dev/site"
    ProxyPreserveHost On
    ProxyRequests Off
    Proxypass / http://siteurl.com:8383/
    ProxypassReverse / http://siteurl.com:8383/
    <Proxy *>
        AuthUserFile /home/admin/.htpasswd
        AuthType Basic
        AuthName "Dev Server"
        Require valid-user
    </Proxy>
</VirtualHost>
-2

This will help.

1st result for Google: vhost password.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .