Skip to content

fix(wand): remove duplicate transfer encoding header meant to be set by nginx proxy#1221

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/wand
Sep 2, 2025
Merged

fix(wand): remove duplicate transfer encoding header meant to be set by nginx proxy#1221
waleedlatif1 merged 1 commit intostagingfrom
fix/wand

Conversation

@waleedlatif1
Copy link
Collaborator

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

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Edit Code Review Bot Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 54d42b3 into staging Sep 2, 2025
2 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/wand branch September 2, 2025 16:15
@vercel vercel bot temporarily deployed to Preview – docs September 2, 2025 16:19 Inactive
@vercel
Copy link

vercel bot commented Sep 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 2, 2025 4:20pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 2, 2025 4:20pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant