Can I coerce Apache into not including a WWW-Authenticate header for failed HTTP Basic Auth?

↘锁芯ラ 提交于 2019-12-11 01:46:42

问题


I'm using HTTP Basic Authentication with AJAX requests. Firefox 3 is a whiner and always displays a dialog box for failed credentials -- even though I don't want one.

This question summarizes some of the browser and JS issues; you'll notice it's unresolved on the client side. Luckily, I have at least some freedom to change the server -- I can modify my .htaccess file.

Basically, whenever Firefox sees the WWW-Authenticate header, it tries to authenticate again. Can I suppress that header only for AJAX requests by modifying my .htaccess file? If so, how? I can pass a custom header in my XHR request if necessary.

Here's what it looks like currently:

AuthType Basic
AuthUserFile /www/private/.htpasswd
AuthName "Private Collection"
require valid-user

回答1:


I faced a similar problem that I solved through a proxy written in nodejs. Perhaps this can help you: Write proxy/wrapper class for own service in jersey



来源:https://stackoverflow.com/questions/928967/can-i-coerce-apache-into-not-including-a-www-authenticate-header-for-failed-http

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!