fix: apply custom headers by target origin, not hardcoded host#16
Merged
Conversation
Replace the hardcoded http://appwrite/ prefix check so screenshots and reports inject custom headers for whatever origin is being captured. This unblocks k8s setups where the router is appwrite-api (via _APP_WORKER_SCREENSHOTS_ROUTER) while still keeping auth headers off third-party subresources. Co-authored-by: Chirag Aggarwal <chiragaggarwal5k@gmail.com>
Docker Image Stats
Screenshot benchmark: Average of 3 runs on https://appwrite.io |
Replace the hardcoded http://appwrite/ prefix so headers follow the screenshot/report URL origin (e.g. http://appwrite-api on k8s). Co-authored-by: Chirag Aggarwal <chiragaggarwal5k@gmail.com>
ChiragAgg5k
marked this pull request as ready for review
July 22, 2026 11:02
Greptile SummaryThis PR applies custom headers according to the requested page’s origin. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "fix: apply custom headers by target orig..." | Re-trigger Greptile |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Custom headers were only applied when the request URL started with hardcoded
http://appwrite/. That breaks setups where_APP_WORKER_SCREENSHOTS_ROUTERis a different internal host (e.g.http://appwrite-apion k8s).This replaces that prefix with the origin of the request URL, so headers follow whatever host is being captured while still staying off third-party subresources.
Changes
src/routes/screenshots.ts/src/routes/reports.ts: match againstnew URL(body.url).origininstead ofhttp://appwrite/Test plan
http://appwrite-api/?appwrite-preview=1with custom headers — headers appliedhttp://appwrite/still works