Mobile app version of vmapp.org
Login or Join
Shanna517

: Nginx, URL special characters and punycode I have an URL with special carachters (nicolòzanetti.com), and I'm having problem telling nginx how to handle it to the correct site. With a basic

@Shanna517

Posted in: #Domains #Nginx #Punycode #Url

I have an URL with special carachters (nicolòzanetti.com), and I'm having problem telling nginx how to handle it to the correct site.

With a basic configuration:(the * in the urls is to tell stackexchange to stop bothering about them)server_name nicolòzanetti.com nicolòzanetti.com;
h*tps://www.nicolòzanetti.com -> Default virtual host but url unchanged
h*tps://nicolòzanetti.com -> Default virtual host but url unchanged
h*tp://www.nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host
h*tp://nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host

So i tried with PunyCode:server_name xn--nicolzanetti-rhb.com xn--nicolzanetti-rhb.com nicolòzanetti.com nicolòzanetti.com;
h*tps://www.nicolòzanetti.com -> Works!
h*tps://nicolòzanetti.com -> Works!
h*tp://www.nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host
h*tp://nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host

I even tried to use regex with ~^www.nicolòzanetti.com$ and ~^www.nicol.zanetti.com$, but it failed again.
Both Nginx in the http declaration and PHP have been set to use utf8, I can't tell the same for perl (I don't even know if I should or how).
I should use the nginx encode function? If yes where can I find some examples please? How else may I solve this?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Shanna517

2 Comments

Sorted by latest first Latest Oldest Best

 

@Samaraweera270

I was testing it with Firefox. nicolòzanetti.com was indeed redirecter to the default virtualhost.
What is funny, is that testing the same with Chrome instead works and I see the Nik page, instead of the wordpress installation.
So how it is that one browser gives me the correct result and Firefox doesn't?
Can anyone explain me the trick behind it? It's about how the browser encode the URL? Any was to enforce the correct encoding server side?

EDIT: I solved this at last, and the culprit was Firefox DNS that were set to last 2592000" (30 days). Flushing Firefox DNS solved the issue.
I actually use the following in nginx as server_name rule for nicolòzanetti.com and nicolòzanetti.com, while keeping also nicolozanetti.com and nicolozanetti.com for all the people that don't have "ò" in their keyboard.
This was tested with Firefox, Internet Explorer, Chrome and Opera (only the last one doesn't show "nicolòzanetti.com" but the punycode instead, however it works correctly). server_name
xn--nicolzanetti-rhb.com xn--nicolzanetti-rhb.com
nicolòzanetti.com nicolòzanetti.com
nicolozanetti.com nicolozanetti.com;
This definitively proves "closetnoc" statement totally false, and I also feel it a little bit discriminatory, like "write 'murican urls worldwide or GTFO", but this is a personal feeling.

10% popularity Vote Up Vote Down


 

@Alves908

I did a whois for nicolòzanetti.com and get:


No match for "NICOLòZANETTI.COM".


I did a whois for nicolozanetti.com and get:


Domain Name: NICOLOZANETTI.COM Registrar: INSTRA CORPORATION
PTY, LTD. Whois Server: whois.instra.net Referral URL:
www.instra.com Name Server: NS1.ONLYDOMAINS.COM
Name Server: NS2.ONLYDOMAINS.COM Name Server:
NS3.ONLYDOMAINS.COM Status: ok Updated Date:
12-mar-2014 Creation Date: 12-mar-2014 Expiration Date:
12-mar-2015


Special characters are not allowed for .com. Forget the special character and you should be fine.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme