Closed ePirat closed 3 months ago
Hi, I'm sorry that this happened to you. #1179 changes the logic of how the url is formatted, and according to the test, the provided domain should work out.
After @MrKrisKrisu has reviewed and deployed the aforementioned PR, maybe this issues is resolved. I would kindly ask you, @ePirat, to report after that. :)
This PR didn't fix this issue. We need to have a look at the validator.
I'm a little bit confused.
In my local environment I can use https://mastodon.sergal.org
without problems. In the production environment with exactly the same code base the error occurs.
When I remove the active_url
validator in our productive env. the domain also works there.
But this isn't a valid solution.
This test already checks whether https://mastodon.sergal.org
will be accepted by the active_url
validator. The test is successful locally and on Github.
The server can also successfully access the Mastodon instance. DNS resolution and access is possible.
kris@maglev:~# curl -vL "https://mastodon.sergal.org/"
* Trying 167.114.35.50:443...
* Connected to mastodon.sergal.org (167.114.35.50) port 443 (#0)
[...]
* SSL certificate verify ok.
[...]
< HTTP/2 200
[...]
* Connection #0 to host mastodon.sergal.org left intact
Tested with some other subdomain instances found on https://joinmastodon.org/servers
All of them are working on prod-server:
Sooo... what is wrong with the domain that the validator doesn't like it?
Laravels documentation describes how the validator is working:
[active_url](https://laravel.com/docs/9.x/validation#rule-active-url)
The field under validation must have a valid A or AAAA record according to the dns_get_record PHP function. The hostname of the provided URL is extracted using the parse_url PHP function before being passed to dns_get_record.
So.. I tried to reproduce this... The DNS Server blocks ANY-Requests. (Edit: This is not relevant as of the validator requests directly A and AAAA)
$domain = 'https://mastodon.sergal.org';
$parsed = parse_url($domain);
dump($parsed);
$result = dns_get_record($parsed['host']);
dump($result);
...and got:
array:2 [
"scheme" => "https"
"host" => "mastodon.sergal.org"
]
array:1 [
0 => array:6 [
"host" => "mastodon.sergal.org"
"class" => "IN"
"ttl" => 3753
"type" => "HINFO"
"cpu" => "RFC8482"
"os" => ""
]
]
Other DNS Servers are returning A and AAAA Records:
array:2 [
"scheme" => "https"
"host" => "social.4netguides.org"
]
array:2 [
0 => array:5 [
"host" => "social.4netguides.org"
"class" => "IN"
"ttl" => 1324
"type" => "A"
"ip" => "37.120.163.132"
]
1 => array:5 [
"host" => "social.4netguides.org"
"class" => "IN"
"ttl" => 1324
"type" => "AAAA"
"ipv6" => "2a03:4000:6:34f0::1"
]
]
With the dns_get_records
function we can explicitly request A or AAAA records. Then we got a correct answer:
array:2 [
"scheme" => "https"
"host" => "mastodon.sergal.org"
]
array:1 [
0 => array:5 [
"host" => "mastodon.sergal.org"
"class" => "IN"
"ttl" => 38
"type" => "A"
"ip" => "167.114.35.50"
]
]
Laravels validation rule can be found here: https://github.com/laravel/framework/blob/81ea922574b5244e6710a82f6e27cd885deec612/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L112-L131
Testing with this original validator function returned this error:
dns_get_record(): A temporary server error occurred.
This only occurs on for mastodon.sergal.org
. Other domains are working.
Therefore the validator returnes false because of the try/catch.
@ePirat I just randomly tried this again. It works for me now with your example domain. No idea why, but can you try it again too?
Describe the bug Trying to login with Mastodon for the instance
https://mastodon.sergal.org
I get an error:domain ist keine gültige Internet-Adresse.
To Reproduce
https://mastodon.sergal.org
domain ist keine gültige Internet-Adresse.
Expected behavior Login should work
Screenshots
Desktop: