Application Rule Details
Here are some custom rules, let’s have a look at the details. Rule 11 is an interesting example.
This rule makes a conditional redirection based on the Accept-Language (request) header.
So when the Accept-Language header contains the word zh, the Chinese language, no matter simplified or traditional,
and the URI equals to /,
and the host name equals to openresty.org,
then we do a redirection to /cn/ with the status code 302 and also the current scheme and host name. So this is an example of doing internationalization or localization. And we also have a similar rule for (the case) Accept-Language contains the word “en” (for English).