fix(wand): remove duplicate transfer encoding header meant to be set by nginx proxy#1221
fix(wand): remove duplicate transfer encoding header meant to be set by nginx proxy#1221waleedlatif1 merged 1 commit intostagingfrom
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR addresses a production deployment issue in the wand generation API endpoint by removing the Transfer-Encoding: chunked header from streaming responses. The change fixes a duplicate header problem that occurs when the application runs behind an nginx reverse proxy.
The core modification is in apps/sim/app/api/wand-generate/route.ts, where the explicit Transfer-Encoding: chunked header has been removed from the response headers object. When applications are deployed behind reverse proxies like nginx, the proxy automatically handles transfer encoding for chunked responses. Setting this header explicitly in the application code creates duplicate headers, which can cause HTTP errors or unexpected behavior.
The streaming response now returns with headers for Content-Type: text/event-stream, Cache-Control: no-cache, no-transform, Connection: keep-alive, and X-Accel-Buffering: no - all appropriate for server-sent events without the problematic transfer encoding header. This change aligns with standard practices for applications deployed behind reverse proxies, where infrastructure-level concerns like transfer encoding are handled by the proxy layer.
Additionally, the PR includes cleanup by removing various inline comments throughout the file, improving code readability without affecting functionality. This is a targeted fix that addresses a specific deployment configuration issue while maintaining the existing streaming capabilities of the wand generation endpoint.
Confidence score: 5/5
- This PR is safe to merge with minimal risk as it removes a problematic header causing deployment issues
- Score reflects a well-understood HTTP protocol issue with a straightforward solution that follows standard practices
- No files require special attention as the change is isolated and addresses a specific reverse proxy configuration problem
1 file reviewed, no comments
Summary
remove duplicate transfer encoding header meant to be set by nginx proxy, otherwise if we set it in the application code it becomes a duplicate header and errors with reverse proxies like nginx
Type of Change
Testing
Tested manually.
Checklist