同一站点上的多个 http 身份验证详细信息 + chrome 保存密码功能,有没有办法处理这种情况?

Mah*_*ahn 17 google-chrome passwords authentication http

谷歌浏览器似乎在每个站点的基础上保存密码,但我正在开发一个站点,我希望根据访问的目录使用不同的 http 身份验证详细信息,并让 Chrome 记住这一点。

也就是说,http://example.com/ahttp://example.com/b有不同的 http 用户/密码组合。我希望 Chrome 记住两者,这样当我输入http://example.com/a 时,我会使用 /a 的相应用户/密码组合进行访问,/b 也是如此。如果我使用内置函数在 Chrome 中保存密码,浏览器会全局保存http://example.com 的用户/密码组合,并且不记得根据地址使用哪一个,而是默认使用其中之一对于在http://example.com 上访问的任何地址

除了为每个目录设置不同的子域之外,还有什么办法可以解决这个问题吗?

小智 2

如果您为不同的子文件夹指定不同的领域,Chrome 将正常运行,例如这在 nginx 中工作得很好:

    location /gabinete-rivera {
        auth_basic "Hijos de Rivera";
        auth_basic_user_file /home/www/public/gabinete-rivera-app/.htpasswd;
        index  index.php index.html;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location /gabinete-gases {
        auth_basic "Gases Fluorados";
        auth_basic_user_file /home/www/public/gabinete-gases-app/.htpasswd;
        index  index.php index.html;
        try_files $uri $uri/ /index.php?$query_string;
    }
Run Code Online (Sandbox Code Playgroud)