Ok, we have finally managed to verify our domain. Our issue was, that we had a general redirect rule on our server. This one had to be disabled for a short time for Apple to verify our domain.
How we fixed it:
1. Entered our domain "example.com" on Apple deveveloper portal
2. Downloaded the "apple-developer-domain-association.txt" file
3. Uploaded that .txt file to our server
4. Disabled our "www." redirect rule "example.com" --> "www.example.com"
5. Clicked on "Verify" domain button in Apple developer portal
6. Apple website now shows a green checkmark --> woohoo domain verified ✅
7. Now enabled our redirect rule again
8. Done! Profit! 😁
More Info:
Apparently Apple will not follow the HTTP 301 redirect responses from your server. Your server needs to delivier the .txt directly under the url "https://example.com/.well-known/apple-developer-domain-association.txt" without any directs.
How to check if redirect is the issue:
1. Open termial and enter "$ curl https://example.com/.well-known/apple-developer-domain-association.txt"
2. It will probably respond with something like the following:
```
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
```
3. Now try "$ curl https://www.example.com/.well-known/apple-developer-domain-association.txt" (with www.)
4. If it responds with the content of the .txt file, then you have the redirect issue.
--> to fix it: disable your "www." redirect url for a short time