Affects Version/s: 7.1.X, Master
Component/s: Core Infrastructure
Sites virtual hosts doesn't work in case they have UTF-8 characters.
Root cause of this issue is:
- We are storing virtual hosts in virtualhost table as UTF-8
- But "Host:" header that we receive from browser is encoden using Punycode (see https://www.punycoder.com/ )
As a workaround you can configure them encoded using Punycode, but the problem is all links are also written to web page using that encoding.
Solution: Create a fallback code that in case the virtualhost is not found and it starts with "xn--" try decoding it using punycode and search again using the decoded UTF-8 string
Steps to reproduce
- Create a new site
- Add a test page to that site with a portlet
- Configure its public virtual host with ññ.example (it has UTF-8 characters)
- Edit your /etc/hosts (Linux) or C:\Windows\System32\drivers\etc\hosts (Windows) file and add following line:
- Open http://ññ.example:8080 in a browser:
- : Home page of created site is created
- : Created site is not displayed
- Additional check: open page source code and check the links:
- : All links are created with "ññ.example"
- : Links are created with other domain: localhost", "127.0.0.1" or "xn--idaa.example"