Search code examples
.htaccessapache2

AuthName in .htaccess not displayed in Chrome


I am trying to secure a website with an .htaccess file with Apache2. It works well but the message specified with the AuthName line is not visible on Chrome (but it is visible on Firefox !). What should I do to make it visible on Chrome?

Here is my .htaccess file

AuthType Basic
AuthName "Restricted Access"
AuthFile "/etc/apache2/.htpasswd"
Require valid-user

On Firefox the pop-up tells

The site ... is requesting your username and password. The site says: "Restricted Access"

But on Chrome it only tells

Sign in


Solution

  • What should I do to make it visible on Chrome?

    There is nothing you can do.

    The browser decides whether it wants to display this information to the user in some way, or not.


    The phrasing used in the Apache documentation already hints at that (highlights by me) -

    https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html#authname:

    The string provided for the AuthName is what will appear in the password dialog provided by most browsers.

    https://httpd.apache.org/docs/2.4/howto/auth.html#gettingitworking:

    The AuthName directive sets the Realm to be used in the authentication. The realm serves two major functions. First, the client often presents this information to the user as part of the password dialog box. Second, it is used by the client to determine what password to send for a given authenticated area.