-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
caddy and https fails with "can't finish registration: Error validating origin" #16
Comments
Added cors to Caddyfile but still same error in GUI. # Caddyfile
{
log {
output stdout
format console
level DEBUG
}
admin :2019
}
(cors) {
@cors_preflight method OPTIONS
header {
Access-Control-Allow-Origin "{header.origin}"
Vary Origin
Access-Control-Expose-Headers "Authorization"
Access-Control-Allow-Credentials "true"
}
handle @cors_preflight {
header {
Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE"
Access-Control-Max-Age "3600"
}
respond "" 204
}
}
# https://localhost
localhost {
file_server {
root .
browse
}
import cors {header.origin}
}
# https://hello.localhost
hello.localhost {
import cors {header.origin}
respond "Hello world!"
}
# https://app.localhost
app.localhost {
import cors {header.origin}
reverse_proxy :8080
}
pertinent log line from caddy. 2024/08/08 04:52:36.379 DEBUG http.handlers.reverse_proxy upstream roundtrip {"upstream": ":8080", "duration": 0.000320792, "request": {"remote_ip": "127.0.0.1", "remote_port": "54512", "client_ip": "127.0.0.1", "proto": "HTTP/2.0", "method": "POST", "host": "app.localhost", "uri": "/api/passkey/registerFinish", "headers": {"Accept-Encoding": ["gzip, deflate, br"], "X-Forwarded-For": ["127.0.0.1"], "Sec-Fetch-Site": ["same-origin"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15"], "Referer": ["https://app.localhost/"], "Content-Length": ["1036"], "X-Forwarded-Proto": ["https"], "Accept-Language": ["en-GB,en;q=0.9"], "Content-Type": ["application/json"], "Sec-Fetch-Mode": ["cors"], "Origin": ["https://app.localhost"], "Cookie": ["REDACTED"], "Sec-Fetch-Dest": ["empty"], "X-Forwarded-Host": ["app.localhost"], "Accept": ["/"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "app.localhost"}}, "headers": {"Content-Type": ["application/json"], "Set-Cookie": ["REDACTED"], "Date": ["Thu, 08 Aug 2024 04:52:36 GMT"], "Content-Length": ["53"]}, "status": 400} |
Great 👍 |
Just trying things out so its easy to debug issues across Mobile and Desktops...
Caddy is very easy to do this, but hit an issue when I register a user:
https://app.localhost is mapped to the passkeys example running on port 8080 with no changes at all to it.
Caddy
caddy run --config Caddyfile --adapter caddyfile
Caddyfile:
The text was updated successfully, but these errors were encountered: