It's possible to declare punycode domains in the Caddyfile as either UTF-8 or ASCII, however, they are never matched
Thank you for the issue.
Which version of Caddy are you using?
caddy -version
Thanks for opening an issue! We'll look into this.
It's not immediately clear to me what is going on, so I'll need your help to understand it better.
Ideally, we need to be able to reproduce the bug _in the most minimal way possible_. This allows us to write regression tests to verify the fix is working. If we can't reproduce it, then you'll have to test our changes for us until it's fixed -- and then we can't add test cases, either.
I've attached a template below that will help make this easier and faster! It will ask for some information you've already provided; that's OK, just fill it out the best you can. :+1:
I've also included some helpful tips below the template. Feel free to let me know if you have any questions!
Thank you again for your report, we look forward to resolving it!
## 1. Environment
### 1a. Operating system and version
paste here
1b. Caddy version (run caddy version or paste commit SHA)
paste here
1c. Go version (if building Caddy from source; run go version)
paste here
2. Description
2a. What happens (briefly explain what is wrong)
2b. Why it's a bug (if it's not obvious)
2c. Log output
paste terminal output or logs here
2d. Workaround(s)
2e. Relevant links
3. Tutorial (minimal steps to reproduce the bug)
Environment: Please fill out your OS and Caddy versions, even if you don't think they are relevant. (They are _always_ relevant.) If you built Caddy from source, provide the commit SHA and specify your exact Go version.
Description: Describe at a high level what the bug is. What happens? Why is it a bug? Not all bugs are obvious, so convince readers that it's actually a bug.
Tutorial: What are the _minimum required specific steps_ someone needs to take in order to experience the same bug? Your goal here is to make sure that anyone else can have the same experience with the bug as you do. You are writing a tutorial, so make sure to carry it out yourself before posting it. Please:
curl.Example of a tutorial:
Create a config file:Open terminal and run Caddy:{ ... }Make an HTTP request:$ caddy ...Notice that the result is ___ but it should be ___.$ curl ...
I'm a past domain registrar, so I'm familiar with Punycode. I immediately tried this with Caddy v2:
xn--38j2b6b6e.jp.eu.org:80 {
respond "ok"
encode zstd gzip
}
Just in my hand was the Punycode subdomain of EU.org: xn--38j2b6b6e.jp.eu.org = γ«γ»γγ.jp.eu.org
This can expect the same result as the Punycode domain.
For quick work, I chose only HTTP.
result:

Caddy v2 appears to output Punycode (sub) domains successfully.
I will test Caddy v1 later.
Thank you for that helpful investigation, @fu-sen ! It is good to know that v2 works at least :)
I switched the VPS Caddy to v1 and tried it:
Caddyfile:
xn--38j2b6b6e.jp.eu.org:80
tls off
root /home/balloon/xn--38j2b6b6e.jp.eu.org
browse
xn--38j2b6b6e.jp.eu.org/index.html:
result:

It's okay. The latest Caddy has no bugs with Punycode domains.
In the first place, Punycode is in ascii notation, so Caddy has no special consideration.
Perhaps this is an individual issue, so the continuation should be on the Forum:
https://caddy.community/
Great! Thanks for verifying that, @fu-sen. I will close this issue then unless it can be shown to be a bug and/or more information is provided.
Then I also tried https. result:

Caddy works perfectly. π
Most helpful comment
I'm a past domain registrar, so I'm familiar with Punycode. I immediately tried this with Caddy v2:
Just in my hand was the Punycode subdomain of EU.org: xn--38j2b6b6e.jp.eu.org = γ«γ»γγ.jp.eu.org
This can expect the same result as the Punycode domain.
For quick work, I chose only HTTP.
result:

Caddy v2 appears to output Punycode (sub) domains successfully.
I will test Caddy v1 later.