mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-11-03 09:12:19 +01:00
A reverse proxy can be told to require HTTP Basic authentication - an Access List in Nginx Proxy Manager, say - which is what makes publishing an instance to the internet reasonable. The wrapper had no answer for that: WebViewClient cancels the request by default, so the app showed nginx's bare 401 page and stopped there. Handle onReceivedHttpAuthRequest instead, asking for the username and password once and keeping them per host, so later launches go straight in. WebView only calls it after a 401 carrying WWW-Authenticate, so an instance that asks for no password never reaches any of this and behaves exactly as before. Credentials are stored before the server has accepted them; a wrong one simply comes back on the next 401 with the username filled in, since useHttpAuthUsernamePassword() tells a first ask from a retry. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0187QpThw1Y8n7aYDjHtMHax