nginx_accept_language_module icon indicating copy to clipboard operation
nginx_accept_language_module copied to clipboard

Scalable language options

Open splitice opened this issue 4 years ago • 1 comments
trafficstars

  • [x] Compiles
  • [x] Tested
  • [x] Squashed

splitice avatar Aug 24 '21 07:08 splitice

@giom tested.

Valid (simple)

# curl 127.0.0.1 --header 'Accept-Language: zh' -v
* Expire in 0 ms for 6 (transfer 0x55c47f0a5fb0)
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x55c47f0a5fb0)
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.64.0
> Accept: */*
> Accept-Language: zh
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx/1.21.2
< Date: Tue, 07 Sep 2021 13:19:43 GMT
< Content-Type: text/html
< Content-Length: 145
< Connection: keep-alive
< Location: http://zh.your_domain.com
<
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.21.2</center>
</body>
</html>
* Connection #0 to host 127.0.0.1 left intac
# curl 127.0.0.1 --header 'Accept-Language: zh,en' -v
* Expire in 0 ms for 6 (transfer 0x55cfabd08fb0)
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x55cfabd08fb0)
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.64.0
> Accept: */*
> Accept-Language: zh,en
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx/1.21.2
< Date: Tue, 07 Sep 2021 13:19:36 GMT
< Content-Type: text/html
< Content-Length: 145
< Connection: keep-alive
< Location: http://en.your_domain.com
<

Empty:

# curl 127.0.0.1 --header 'Accept-Language: ' -v
* Expire in 0 ms for 6 (transfer 0x563fc86d2fb0)
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x563fc86d2fb0)
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx/1.21.2
< Date: Tue, 07 Sep 2021 13:11:09 GMT
< Content-Type: text/html
< Content-Length: 145
< Connection: keep-alive
< Location: http://en.your_domain.com
<

Looks good.

splitice avatar Sep 07 '21 13:09 splitice