Failed to validate ownership of domainName
Describe the bug
Sample application thorws Failed to validate ownership of domainName when testing with ngrok.
I am using the LettuceEncrypt sample application together with ngrok (ngrok http 80) to test Lets Encrypt certificate creation.
fail: LettuceEncrypt.Internal.AcmeCertificateFactory[0]
Failed to validate ownership of domainName 't79b-149-167-20-95.ngrok-free.app'. Reason: urn:ietf:params:acme:error:tls: x.xxxx:Xxx:Xx: remote error: tls: no application protocol, Code = BadRequest
trce: LettuceEncrypt.Internal.TlsAlpnChallengeResponder[0]
Clearing ALPN cert for t79b-149-167-20-95.ngrok-free.app
dbug: LettuceEncrypt.Internal.AcmeCertificateFactory[0]
Validation with TlsAlpn01DomainValidator failed with error: Failed to validate ownership of domainName 't79b-149-167-20-95.ngrok-free.app'
System.InvalidOperationException: Failed to validate ownership of domainName 't79b-149-167-20-95.ngrok-free.app'
at LettuceEncrypt.Internal.DomainOwnershipValidator.WaitForChallengeResultAsync(IAuthorizationContext authorizationContext, CancellationToken cancellationToken) in C:\Users\Desktop\LettuceEncrypt-main\src\LettuceEncrypt\Internal\DomainOwnershipValidator.cs:line 56
my question is how to test the sample application.
To Reproduce Steps to reproduce the behavior:
- Use sample web project
- RUN ngrok http 80 and get the domain url
- Update appsettings
- Run the code
- Error shown on console
Expected behavior Get certificate
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Because you did not add DnsChallengeProvider For example: services.AddLettuceEncrypt().PersistDataToDirectory(new DirectoryInfo(AppContext.BaseDirectory), "abc123456"); services.AddxxxxxxxDnsChallengeProvider();
It has been a long time since I tried playing with ngrok to test this. https://github.com/natemcmaster/LettuceEncrypt/blob/49e2c62ed9107294aca992f128ef37a7efc16b76/test/Integration/README.md contains some instructions which I haven't tried several years. Can you give those steps a try?