I upgraded caddy including the security plugin, I did not realized it right away but the api calls are not working anymore.
I am sure I am doing something wrong, but I can't figure out what.
At the bottom I added the logs where the token is visible both, on query and header request.
The token should be found and validated.
{"level":"debug","ts":1778241916.1855297,"logger":"events","msg":"event","name":"tls_get_certificate","id":"1d25b481-204a-45c5-b4c4-6267a100c8f9","origin":"tls","data":{"client_hello":{"CipherSuites":[4866,4867,4865,49196,49200,159,52393,52392,52394,49195,49199,158,49188,49192,107,49187,49191,103,49162,49172,57,49161,49171,51,157,156,61,60,53,47,255],"ServerName":"api.domain.com","SupportedCurves":[29,23,30,25,24,256,257,258,259,260],"SupportedPoints":"AAEC","SignatureSchemes":[1027,1283,1539,2055,2056,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,769,770,1026,1282,1538],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[772,771],"RemoteAddr":{"IP":"10.200.8.110","Port":57504,"Zone":""},"LocalAddr":{"IP":"172.16.2.11","Port":443,"Zone":""}}}}
{"level":"debug","ts":1778241916.1856217,"logger":"tls.handshake","msg":"choosing certificate","identifier":"api.domain.com","num_choices":1}
{"level":"debug","ts":1778241916.1856284,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"api.domain.com","subjects":["api.domain.com"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"eadaf8b2c8c60ecef4fa9ab5b6febe7443a2c805c02da81e4fcb34b6734a20dc"}
{"level":"debug","ts":1778241916.1856363,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"10.200.8.110","remote_port":"57504","subjects":["api.domain.com"],"managed":true,"expiration":1780938839,"hash":"eadaf8b2c8c60ecef4fa9ab5b6febe7443a2c805c02da81e4fcb34b6734a20dc"}
{"level":"debug","ts":1778241916.2168078,"logger":"security","msg":"token validation error","session_id":"","request_id":"59417a7f-c26a-4cf4-a2b7-b1d1646a0839","error":"no token found"}
{"level":"debug","ts":1778241916.2168446,"logger":"security","msg":"redirecting unauthorized user","session_id":"","request_id":"59417a7f-c26a-4cf4-a2b7-b1d1646a0839","method":"location"}
{"level":"error","ts":1778241916.2168713,"logger":"http.handlers.authentication","msg":"auth provider returned error","provider":"authorizer","error":"user authorization failed: src_ip=10.200.8.110, src_conn_ip=10.200.8.110, reason: no token found"}
{"level":"debug","ts":1778241916.216919,"logger":"http.log.error","msg":"not authenticated","request":{"remote_ip":"10.200.8.110","remote_port":"57504","client_ip":"10.200.8.110","proto":"HTTP/2.0","method":"GET","host":"api.domain.com","uri":"/api2/users","headers":{"User-Agent":["curl/8.5.0"],"Accept":["*/*"],"Api_token":["eyJ0eXAiOiA...REDACTED"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.domain.com","ech":false}},"duration":0.000200436,"status":401,"err_id":"mmqjgbrwi","err_trace":"caddyauth.Authentication.ServeHTTP (caddyauth.go:99)"}
{"level":"debug","ts":1778241916.2284865,"logger":"security","msg":"token validation error","session_id":"","request_id":"1fc0345f-e5ea-4170-947a-cdf600c10c84","error":"no token found"}
{"level":"debug","ts":1778241916.2285159,"logger":"security","msg":"redirecting unauthorized user","session_id":"","request_id":"1fc0345f-e5ea-4170-947a-cdf600c10c84","method":"location"}
{"level":"error","ts":1778241916.2285302,"logger":"http.handlers.authentication","msg":"auth provider returned error","provider":"authorizer","error":"user authorization failed: src_ip=10.200.8.110, src_conn_ip=10.200.8.110, reason: no token found"}
{"level":"debug","ts":1778241916.2285697,"logger":"http.log.error","msg":"not authenticated","request":{"remote_ip":"10.200.8.110","remote_port":"57504","client_ip":"10.200.8.110","proto":"HTTP/2.0","method":"GET","host":"api.domain.com","uri":"/auth?redirect_url=https%3A%2F%2Fapi.domain.com%2Fapi2%2Fusers","headers":{"User-Agent":["curl/8.5.0"],"Accept":["*/*"],"Api_token":["eyJ0eXAiOiA...REDACTED"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.domain.com","ech":false}},"duration":0.000187446,"status":401,"err_id":"9hzkjrag0","err_trace":"caddyauth.Authentication.ServeHTTP (caddyauth.go:99)"}
{"level":"debug","ts":1778241916.270234,"logger":"events","msg":"event","name":"tls_get_certificate","id":"d079a79f-26d1-49ee-b810-566d75c93413","origin":"tls","data":{"client_hello":{"CipherSuites":[4866,4867,4865,49196,49200,159,52393,52392,52394,49195,49199,158,49188,49192,107,49187,49191,103,49162,49172,57,49161,49171,51,157,156,61,60,53,47,255],"ServerName":"api.domain.com","SupportedCurves":[29,23,30,25,24,256,257,258,259,260],"SupportedPoints":"AAEC","SignatureSchemes":[1027,1283,1539,2055,2056,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,769,770,1026,1282,1538],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[772,771],"RemoteAddr":{"IP":"10.200.8.110","Port":57512,"Zone":""},"LocalAddr":{"IP":"172.16.2.11","Port":443,"Zone":""}}}}
{"level":"debug","ts":1778241916.2703373,"logger":"tls.handshake","msg":"choosing certificate","identifier":"api.domain.com","num_choices":1}
{"level":"debug","ts":1778241916.2703478,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"api.domain.com","subjects":["api.domain.com"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"eadaf8b2c8c60ecef4fa9ab5b6febe7443a2c805c02da81e4fcb34b6734a20dc"}
{"level":"debug","ts":1778241916.2703586,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"10.200.8.110","remote_port":"57512","subjects":["api.domain.com"],"managed":true,"expiration":1780938839,"hash":"eadaf8b2c8c60ecef4fa9ab5b6febe7443a2c805c02da81e4fcb34b6734a20dc"}
{"level":"debug","ts":1778241916.3023055,"logger":"security","msg":"token validation error","session_id":"","request_id":"b71fa4c4-62d1-4aa1-8271-870e8f958a1f","error":"no token found"}
{"level":"debug","ts":1778241916.3023324,"logger":"security","msg":"redirecting unauthorized user","session_id":"","request_id":"b71fa4c4-62d1-4aa1-8271-870e8f958a1f","method":"location"}
{"level":"error","ts":1778241916.3023489,"logger":"http.handlers.authentication","msg":"auth provider returned error","provider":"authorizer","error":"user authorization failed: src_ip=10.200.8.110, src_conn_ip=10.200.8.110, reason: no token found"}
{"level":"debug","ts":1778241916.3023806,"logger":"http.log.error","msg":"not authenticated","request":{"remote_ip":"10.200.8.110","remote_port":"57512","client_ip":"10.200.8.110","proto":"HTTP/2.0","method":"GET","host":"api.domain.com","uri":"/api2/users?api_token=eyJ0eXAiOiA...REDACTED","headers":{"User-Agent":["curl/8.5.0"],"Accept":["*/*"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.domain.com","ech":false}},"duration":0.000132105,"status":401,"err_id":"cx5hawbpc","err_trace":"caddyauth.Authentication.ServeHTTP (caddyauth.go:99)"}
Describe the issue
I upgraded caddy including the security plugin, I did not realized it right away but the api calls are not working anymore.
I am sure I am doing something wrong, but I can't figure out what.
At the bottom I added the logs where the token is visible both, on query and header request.
My curl looks like that:
Configuration
Paste full
Caddyfilebelow:Version Information
Provide output of
caddy list-modules --versions | grep -E "(auth|security)"below:Expected behavior
The token should be found and validated.
Additional context
Debug Log: