Fix session termination issue in proxy#5
Fix session termination issue in proxy#5google-labs-jules[bot] wants to merge 3 commits intomainfrom
Conversation
The `contains` mapping type was truncating the request path for AJAX calls, leading to session errors. This change switches to the `prefix` mapping type to ensure the full path is forwarded to the backend.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
The servlet was not rewriting the `Location` header in redirect responses from the backend, causing the client's browser to bypass the proxy and terminate the session. This change adds logic to detect redirect responses and rewrite the `Location` header to point back to the proxy server, ensuring session continuity.
This commit addresses two interacting bugs that caused session timeouts: 1. **Path Matching in Non-Root Contexts:** The servlet now correctly strips the application's context path from the request URI before matching it against URL mappings. This ensures correct behavior when the proxy is deployed in a non-root context. 2. **Cookie Handling During Redirects:** The servlet now strips the `Domain` attribute from `Set-Cookie` headers during redirects. This prevents the browser from sending session cookies to the wrong domain, which was causing immediate session timeouts.
This change addresses a session termination issue in the
SimpleProxyServlet. The root cause was an incorrect URL mapping inweb.xmlthat used thecontainstype, which truncated the request path for AJAX calls and caused the session to be invalidated. By switching to theprefixmapping type, the full request path and query string are now correctly forwarded, resolving the issue.PR created automatically by Jules for task 1207791721121253774