Disable logins for a Plone site

by Matthew Wilkes last modified Feb 08, 2011 01:21 PM

Using Apache

Modify any VirtualHost sections that proxy to Plone to include the two RequestHeader lines shown below. You will need mod_headers installed.

To install mod_headers on ubuntu or debian run the following command:

sudo a2enmod headers
/etc/init.d/apache2 force-reload

Then configure apache:

<VirtualHost *:80>

ServerName www.example.com RequestHeader unset Cookie RequestHeader unset Authorization RewriteEngine On ... </VirtualHost>

Using nginx

Just use proxy_hide_header statement:

server {
       
        server_name   example.com;
         .......
        location / {
                rewrite ^(.*)$ /VirtualHostBase/http/$server_name:80/HomePage/VirtualHostRoot$1 break;
                proxy_pass   http://127.0.0.1:22380;
                proxy_set_header Cookie null;
                proxy_set_header Authorization null;
        }
}
 

Using Varnish

Modify your vcl_recv function so the following is at the top:

sub vcl_recv {
  remove req.http.Cookie;
  remove req.http.Authorization;
  ... 
}


Verification

Remember to attempt to log in after making these changes, to ensure that logins are correctly blocked. As this prevents only the login your users will still see login links and they may see success messages when they try to log in.  If you intend the block to be permanent the login form links should be removed, otherwise you should inform your users that this behaviour is expected.