0

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 www.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 www.xn--nicolzanetti-rhb.com xn--nicolzanetti-rhb.com www.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?

Kunepro
  • 23
  • 2
  • 5

2 Answers2

1

I was testing it with Firefox.
http://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 www.nicolòzanetti.com and nicolòzanetti.com, while keeping also www.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 www.xn--nicolzanetti-rhb.com xn--nicolzanetti-rhb.com www.nicolòzanetti.com nicolòzanetti.com www.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.

Kunepro
  • 23
  • 2
  • 5
0

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: http://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.

Zistoloen
  • 10,056
  • 6
  • 36
  • 59
closetnoc
  • 32,902
  • 4
  • 46
  • 69