Woodpecker CI OAuth Login Loop Issue - Detailed Report #5761
Replies: 3 comments
-
|
Thanks for the detailed report. Could you update to the latest Woodpecker version? Is the Cookie header not forwarded by your reverse proxies? |
Beta Was this translation helpful? Give feedback.
-
|
closing as no response from opener |
Beta Was this translation helpful? Give feedback.
-
|
Hi there, I am getting the same sort of behaviour with Bitbucket forge: OAuth link works, but I end up not logged in on the Wood pecker side, so it manifests as an infinite loop to /login. I have tried many of the same troubleshooting steps and was wondering if you did find a solution. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Woodpecker CI successfully completes GitHub OAuth authentication and creates a session cookie, but the session cookie is not recognized on subsequent requests, resulting in an infinite login loop. The user exists in the database, the cookie is set with correct attributes and sent in all requests, but Woodpecker's session middleware does not validate/recognize it.
TL;DR for Maintainers
What works:
user_sess) created with valid JWT payloadWhat fails:
WOODPECKER_LOG_LEVEL=trace)WOODPECKER_USER = null) after successful OAuth/loginEnvironment:
X-Forwarded-Proto,X-Forwarded-For,X-Forwarded-Host)WOODPECKER_SECRETset for consistent JWT signingKey observation: Complete absence of session validation log messages suggests the session middleware is not attempting to read/validate cookies in this reverse proxy configuration.
Author's Note
This report was prepared with the assistance of Claude (Anthropic's AI assistant) to ensure comprehensive documentation of the troubleshooting process.
While I am a fairly competent IT professional who successfully hosts a variety of services (including multiple containerized applications behind the same reverse proxy setup), I acknowledge that I could easily be overlooking something in my configuration. The complexity of this multi-layer proxy setup (Cloudflare → NPM → Woodpecker) introduces many potential points of failure, and despite my best efforts, there may be a simple configuration issue I've missed.
I've included extensive diagnostic information in this report to help identify whether this is a configuration issue on my end, a documentation gap, or a potential bug. I appreciate any guidance the maintainers can provide, and I'm happy to provide additional information or test potential fixes.
Request for Assistance
This issue requires Woodpecker maintainer expertise to diagnose. Possible next steps:
Environment
Infrastructure
https://woodpecker.example.comhttp://192.168.x.x:8001Software Versions
woodpeckerci/woodpecker-server:latest)woodpeckerci/woodpecker-agent:latest)Configuration
Docker Compose (
docker-compose.woodpecker.yml)Environment Variables (
.env)GitHub OAuth App Configuration
https://woodpecker.example.comhttps://woodpecker.example.com/authorizeNginx Proxy Manager Configuration
Proxy Host Details:
woodpecker.example.comhttp192.168.x.x8001Custom Nginx Configuration (Advanced tab):
Generated NPM Config (actual configuration):
Cloudflare Configuration
woodpecker.example.com→ A record → Server IPIssue Description
Expected Behavior
https://woodpecker.example.com/loginhttps://woodpecker.example.com/authorize?code=...user_sesscookieuser_sesscookie and user remains logged inActual Behavior
/authorize?code=...✓/login✗Diagnostic Evidence
1. Session Cookie is Created
Browser Application tab shows cookie is set after OAuth:
JWT payload decoded:
{ "exp": 1763695751, "type": "sess", "user-id": "1" }2. Cookie is Sent in Subsequent Requests
Browser Network tab shows
Cookieheader in requests:3. User Exists in Database
sqlite3 /mnt/user/appdata/woodpecker-ci/server-data/woodpecker.sqlite "SELECT * FROM users;"Output:
User record shows:
4. Woodpecker Logs (Trace Level)
OAuth flow completes successfully:
{"level":"trace","message":"[GET] /authorize?forgeId=1"} {"level":"debug","method":"GET","path":"/authorize","status":303} {"level":"trace","message":"[GET] /authorize?code=...&state=..."} {"level":"debug","method":"GET","path":"/authorize","status":303} {"level":"trace","message":"[GET] /"} {"level":"debug","method":"GET","path":"/","status":200}Critical observation: No log messages about:
Even with
WOODPECKER_LOG_LEVEL=trace, there are zero log entries indicating the session middleware is attempting to validate the cookie.5. Homepage Shows No User
After OAuth redirect, page source shows:
6. No Errors in Logs
Woodpecker container is healthy and stable:
/healthzreturns 204)Troubleshooting Steps Attempted
1. Proxy Header Configuration ✓
X-Forwarded-Proto,X-Forwarded-For,X-Forwarded-Host,X-Real-IPheadersX-Forwarded-Forimplementation ($remote_addr→$proxy_add_x_forwarded_for)2. Secret Management ✓
WOODPECKER_SECRETenvironment variable with strong random value3. Server Configuration ✓
WOODPECKER_SERVER_ADDR=:8000WOODPECKER_LOG_LEVEL=tracefor maximum verbosityWOODPECKER_SESSION_EXPIRES=72h4. SSL/TLS Configuration ✓
5. Network Configuration ✓
proxynetDocker networkhttp://192.168.x.x:80016. OAuth Configuration ✓
https://woodpecker.example.com/authorize7. Database Verification ✓
8. Cookie Analysis ✓
/(covers all routes)Network Analysis
HAR File Analysis
From captured HAR file:
Set-Cookieheaders found in responses during first OAuth attemptCookie: user_sess=...headerNPM Error Logs
Potential Root Causes
1. Session Middleware Not Reading Cookies
2. JWT Secret Mismatch (Ruled Out)
WOODPECKER_SECRETis now set and consistent3. Proxy Header Trust Issues (Unlikely)
4. Cookie Domain/Path Mismatch (Ruled Out)
/5. SameSite Cookie Attribute (Unknown)
6. Database Session Storage Issue (Unlikely)
Configuration Gaps
Potentially Missing Environment Variables
The following environment variables were NOT set (may or may not be relevant):
WOODPECKER_BEHIND_PROXY- May be needed to enable proxy modeWOODPECKER_COOKIE_SECURE- Explicit cookie security settingWOODPECKER_COOKIE_SAMESITE- SameSite attribute controlWOODPECKER_PROXY_PASS_HEADER- Enable proxy header trustThese variables are not documented in Woodpecker's environment variable documentation, so their existence/necessity is unknown.
Conclusion
This issue represents a session validation failure in Woodpecker CI when deployed behind a complex reverse proxy setup (Cloudflare → Nginx Proxy Manager → Woodpecker).
Key facts:
The complete absence of session validation log messages (even at trace level) suggests Woodpecker's session middleware is not attempting to read or validate cookies in this configuration. This may indicate:
Additional Information
Report generated: 2025-11-18
Woodpecker version: 2.8.3
Setup type: Docker Compose on Unraid
Beta Was this translation helpful? Give feedback.
All reactions