2

I'd like to show cyrillic message in a browser's "HTTP Basic Authentication" prompt, but end up with abracadabra.

Here's my NGINX config:

server {
  charset utf-8;
  listen 80;
  server_name example.com;
  root /path;
  include snippets/wordpress.conf;
  auth_basic "Введите пароль.";
  auth_basic_user_file /etc/nginx/.htpasswd;
}

here's curl output, that looks pretty, with utf-8 as content-type charset:

$ curl -I http://example.com/
HTTP/1.1 401 Unauthorized
Date: Sat, 12 Dec 2015 08:37:41 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: __cfduid=x; expires=Sun, 11-Dec-16 08:37:41 GMT; path=/; domain=.mydomain.com; HttpOnly
WWW-Authenticate: Basic realm="Введите пароль."
Server: cloudflare-nginx
CF-RAY: xxxxxxxxxxxx-ARN

but here's the output of Chrome, Safari, Opera, Yandex browser... every browser I was able to try:

To view this page, you must log in to this area on example.com:80: ÐведиÑе паÑолÑ.

2 Answers 2

1

For completeness: in a newer question on serverfault, I found this answer

RFC 7617 Section 3

The 'realm' parameter carries data that can be considered textual; however, `[RFC7235] does not define a way to reliably transport non- US-ASCII characters. This is a known issue that would need to be addressed in a revision to that specification.

realm parameter is the string you put in auth_basic directive. So, can't suggest anything, but stick to ASCII.

Sign up to request clarification or add additional context in comments.

Comments

1

You can try using quoted-printable text

server {
  charset utf-8;
  listen 80;
  server_name example.com;
  root /path;
  include snippets/wordpress.conf;
  auth_basic "=?UTF-8?Q?=D0=92=D0=B2=D0=B5=D0=B4=D0=B8=D1=82=D0=B5=20=D0=BF=D0=B0=D1=80=D0=BE=D0=BB=D1=8C.?=";
  auth_basic_user_file /etc/nginx/.htpasswd;
}

1 Comment

It didn't work; the text displayed in browser is just the same as in config (=?UTF-8?Q?=D0...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.