outroll / vesta

VESTA Control Panel
http://vestacp.com
GNU General Public License v3.0
2.96k stars 1.03k forks source link

IDN support is "broken" with nginx #1482

Open SteenSchutt opened 6 years ago

SteenSchutt commented 6 years ago

Operating System (OS/VERSION):

Debian 8.7 (Probably 9 as well)

VestaCP Version:

0.9.8 rel. 19

Installed Software (what you got with the installer):

apache, nginx, mysql

Steps to Reproduce:

  1. Create a new web domain using IDN. (e.g. nrsøbykød.dk)
  2. Visit the website using that domain

Vesta converts this to punycode (Which I generally think is good practice) but for some reason nginx has stopped parsing this correctly, meaning that going to this page yields the default VestaCP page for the server. We haven't yet seen this issue on other machines, but I also don't think we have other IDNs.

We worked around this issue by manually adding the domain without using punycode to server_name in the nginx configuration.

madeITBelgium commented 6 years ago

Can you try to edit the template? /usr/local/vesta/data/templates/web/nginx/[YOUR TEMPLATE].tpl After changing rebuild the user. Can you try changing %domain_idn% to %domain%

Here is an example of a tpl file: https://github.com/serghey-rodin/vesta/blob/master/install/debian/8/templates/web/nginx/hosting.tpl#L3

Skamasle commented 6 years ago

I test this issue in centos 7 and debian 8 and yes, in centos 7 works fine, in debian 7 fail

domain_idn is not pased from v-add-web-domain to main.sh is broken in some part but if you add it vía cli all works fine

In my case apache and nginx get broken idn

Cli works perfect, can you test v-add-web-domain user domain ?

Skamasle commented 6 years ago

Hi again, I debug this in debian system,

The issue is a locale problem.

So may fail in some systems and not fail in orther systems

The solutions is set locale in func/main.sh

just add

export LC_ALL="es_ES.UTF-8"

or whatever you use

I think this need be added to vesta for use same locale in all systems and prevent problems, idn domains fail in dns, mail and some orhers

To test you can add it here and not at top

function format_domain_idn() {
    if [ -z "$domain_idn" ]; then
        domain_idn=$domain
    fi
    if [[ "$domain_idn" = *[![:ascii:]]* ]]; then
                export LC_ALL="es_ES.UTF-8"
        domain_idn=$(idn -t --quiet -a $domain_idn)
    fi
}
SteenSchutt commented 6 years ago

Setting LC_ALL makes no difference, same goes for using the CLI to create the domain. Only thing that really helps is changing the default template to use the domain var instead of domain_idn which isn't really a good solution.

Skamasle commented 6 years ago

I will check it again but in my debian 8 I can reproduce this issue and a modification in locale in main.sh fix it.

Can you sayme what locale you use by default ?

And what locale you set in main.sh ?

SteenSchutt commented 6 years ago

@Skamasle I use en_DK.UTF-8. I have also verified that the locale exists on the server.

Rubatharisan commented 6 years ago

Is there any status update upon this issue? Thank you :)

jonathan-martz commented 4 years ago

Looks like its still broken ...