NanoHttpd / nanohttpd

Tiny, easily embeddable HTTP server in Java.
http://nanohttpd.org
BSD 3-Clause "New" or "Revised" License
6.92k stars 1.69k forks source link

Basic auth: how to send WWW-Authenticate header to the client #496

Closed rportab closed 6 years ago

rportab commented 6 years ago

Hi! I'm writing a nanolet with non-preemptive Basic authorization support. I didn't find a way to get a WWW-Authenticate header in the Response. This header is needed so that the client retries the request with authentication (https://en.wikipedia.org/wiki/Basic_access_authentication#Protocol). Is there something I'm missing? Can anybody provide info on how this may be achieved? Thanks a lot

rportab commented 6 years ago

So the way to do it is Response.addHeader Sorry for opening the issue too early