3

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
Community
  • 1
  • 1
Ian Terrell
  • 10,667
  • 11
  • 45
  • 66
  • Am I missing how this is different from the question you asked an hour ago? http://stackoverflow.com/questions/928874/how-do-i-keep-firefox-from-prompting-for-username-password-with-http-basic-auth-w – ceejayoz May 30 '09 at 04:07
  • The previous question was focused on a client-side solution to the problem, which appears to be impossible. This is focused on a server side solution with a specific server setup and limitations. – Ian Terrell May 30 '09 at 04:32
  • Also, it's a problem that's generalizable out beyond just this one application -- it's about setting headers in general, not about Firefox. – Ian Terrell May 30 '09 at 04:32

1 Answers1

0

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

Community
  • 1
  • 1