Can I coerce Apache into not including a WWW-Authe

2019-07-14 02:26发布

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条回答
别忘想泡老子
2楼-- · 2019-07-14 02:41

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

查看更多
登录 后发表回答