Repository navigation
Answer CORS preflight requests, and fix ferris's add-a-hit response missing it entirely - #80
Merged
Merged
Conversation
…issing it entirely Both services are meant to be called from any page embedding a box, but Flask’s own automatic OPTIONS response to a preflight request never ran through roxy()/ferris() at all – it answers before the view function is called – so it never got the Access-Control-Allow-Origin header those functions set. A request stops being CORS-simple (no preflight needed) past a certain Accept header length, which rss-box just hit after adding JSON Feed to its Accept list – breaking every embedded box on every third-party page, not just JSON Feed ones, since the preflight now fails before the real request is ever sent. Along the way, found ferris()’s own add-a-hit response (the actual per-embed referrer ping) never set the header at all, on any request, preflighted or not – silently broken via CORS from the start, independent of today’s regression. Centralized in one app.after_request hook instead of setting it in each response path, so a future response path can’t repeat the same mistake. Verified directly: a real preflight OPTIONS request to /roxy now gets Access-Control-Allow-Origin, Access-Control-Allow-Headers, and Access-Control-Allow-Methods; a real GET to /ferris’s add-a-hit path now gets Access-Control-Allow-Origin too. Full test suite and entrecote’s own smoke test still pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 28, 2026
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
Live bug, actively breaking embedded boxes on third-party sites right now.
roxy()/ferris()at all – it answers before the view function is called – so it never got theAccess-Control-Allow-Originheader those functions set.Acceptheader length, which rss-box just crossed after adding JSON Feed to its Accept list – breaking every embedded box on every third-party page, not just JSON Feed ones, since the preflight now fails before the real request is ever sent. (Companion fix on the rss-box side trims the Accept header back under that limit.)ferris()’s own add-a-hit response (the actual per-embed referrer ping) never set the header at all, on any request, preflighted or not – silently broken via CORS from the start, independent of today’s regression.app.after_requesthook instead of setting it in each response path, so a future response path can’t repeat the same mistake.Test plan
OPTIONSrequest to/roxynow getsAccess-Control-Allow-Origin,Access-Control-Allow-Headers, andAccess-Control-Allow-Methods; a realGETto/ferris’s add-a-hit path now getsAccess-Control-Allow-Origintootest.shsuite passesentrecote.py’s own smoke test (including the concurrency regression check) still passes🤖 Generated with Claude Code