Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

WWW-Authenticate prompt is not displaying realm

  • 11 个回答
  • 1 人有此问题
  • 10 次查看
  • 最后回复者为 petermudge

more options

I have a web page which includes the following header:

WWW-Authenticate: Basic realm="xxxx"

where xxxx is a text string, the name of the realm. This header causes the browser to pop-up a dialogue box in which the user should enter a user name and password. The dialogue box is functioning correctly. However, there is a problem with what it displays. It should include the name of the realm ("xxxx" in this example), but it does not do so. It seems that this problem has only started occurring recently. Until a little while ago, the dialogue box used to include the sentence: 'The site says "xxxx".' Why does it no longer do so?

I have a web page which includes the following header: WWW-Authenticate: Basic realm="xxxx" where xxxx is a text string, the name of the realm. This header causes the browser to pop-up a dialogue box in which the user should enter a user name and password. The dialogue box is functioning correctly. However, there is a problem with what it displays. It should include the name of the realm ("xxxx" in this example), but it does not do so. It seems that this problem has only started occurring recently. Until a little while ago, the dialogue box used to include the sentence: 'The site says "xxxx".' Why does it no longer do so?

所有回复 (11)

more options

I don't know if I have used any servers that prompt in that way. This is what I get for IIS Windows Auth (I've covered the server name):

more options

Yes. That looks like the same problem that I'm getting. It shows the server name, but not the realm. I really want it to show the realm (like it used to do), because I've got several different realms on the same server.

more options

Sorry, I don't know how to test and compare since I don't configure servers. You could search for any bugs on file about this and, if needed, file a new one:

https://bugzilla.mozilla.org/

more options

I don't think it is a server problem. I think it's a browser problem. My evidence for this is that it works correctly with Internet Explorer. The IE pop-up text is

The server <server name> is asking for your user name and password. That server also reports "<name of realm>".

It is that second sentence (quoting the name of the realm) that seems to be missing with most other browsers (such as Firefox and Chrome).

more options

Right, I meant that I can't create a test case and look under the covers because I don't know how to set up such a prompt.

Do you have a lot of bandwidth and patience? You can run a regression test to isolate the patch responsible for the change:

https://mozilla.github.io/mozregression/

more options

Thanks. In principle, yes, I suppose I could try to do a regression test. However, I don't have especially great bandwidth (not sure about the patience). The test itself could be very simple. At its minimum, I think it just needs a tiny PHP file:

<?php
    header('WWW-Authenticate: Basic , realm="This is the text that should be displayed in the prompt."');
?>

由cor-el于修改

more options

Sorry, my code doesn't seem to be displayed correctly. It should start with "".

more options

Thanks, you need to use the HTML entity (&lt;) when posting here:

<?php header('WWW-Authenticate: Basic , realm="This is the text that should be displayed in the prompt."'); ?>

more options

Trying again: It should start with "<?php" and end with "?>".

more options

Yes, I worked that out myself eventually!

more options

Actually, I see that what I sent you wasn't quite right. There's an extra comma that I tried inserting to see if it would fix the problem (which it didn't). The code should be:

<?php

   header('WWW-Authenticate: Basic realm="This is the text that should be displayed in the prompt."');

?>