Copyright ©

Mongoose OS Forum

ATTENTION! This forum has moved to:

Do not post any new messages.

Mongoose 6.5: Trigger basic auth

In some situations, I am executing the following code in my web event handler to trigger the browser to use basic authentication:

mg_send_head(c, 401, 0, "WWW-Authenticate: Basic realm=\"User Visible Realm\"");
mg_send(c, NULL, 0);
c->flags |= MG_F_SEND_AND_CLOSE;

However, I am encountering strange behaviour, so I'd like to ask if this is correct.


  • SergeySergey Dublin, Ireland

    Seems fine. mg_send(c, NULL, 0); call is not necessary.

  • Thanks a lot. (I think the strange behaviour was due to other aspects of my web handler code.)

Sign In or Register to comment.