Topic on Project:Support desk

Visual Editor on a password protected site

2
Summary by Eddie K Smith

Solved using the following:


   SetEnvIfNoCase User-Agent VisualEditor-MediaWiki/* visualeditor

   <Directory /var/www/>

               AuthUserFile /var/www/files/.htpasswd

               AuthName "Restricted Access"

               AuthType Basic

               Require local

               Require env visualeditor

               Require valid-user

   </Directory>

Eddie K Smith (talkcontribs)

Hello, for the testing version of my site, I would like to have the site password protected (its under a sub-domain).

The way I was trying to do this was through .htaccess, now when I do that I get a 401 from Parsoid Visual Editor.


From the following: User:Andrujhon/Allow Parsoid Server I was assuming that to fix it all I needed to do was whitelist localhost. So I tried moving the authentication to my apache2 config with the following (https://stackoverflow.com/a/27209938/14435944):

<Directory /var/www/>

   AuthType Basic

   AuthName "Please enter your username and password"

   AuthUserFile /var/www/files/.htpasswd

   <RequireAny>

     Require ip 127.0.0.1

Require ip ::1

Require ip local

     Require valid-user

   </RequireAny>

</Directory>


But it is still blocking my parsoid (deleting the password protection makes parsoid/visual editor works correctly, to be clear).


Does anyone know what I'm doing wrong, or any better suggestion as to having a testing sub-domain password protected?


Thank you

Eddie

Eddie K Smith (talkcontribs)

Also tried the following:


<Directory /var/www/>

   <If "%{REMOTE_ADDR} != '127.0.0.1'">

       AuthType Basic

       AuthName "Development Environment"

       AuthUserFile /var/www/files/.htpasswd

       require valid-user

   </If>

</Directory>


Which looks very similar to User:Andrujhon's solution. Just that it is done in apache conf instead of LocalSettings.php.