Skip to content

Fix preview proxy REST origin rewriting#2100

Open
chubes4 wants to merge 1 commit into
mainfrom
fix/2095-preview-rest-origin
Open

Fix preview proxy REST origin rewriting#2100
chubes4 wants to merge 1 commit into
mainfrom
fix/2095-preview-rest-origin

Conversation

@chubes4

@chubes4 chubes4 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • rewrite the exact upstream Playground origin to the local preview origin in textual proxy responses and response headers
  • stream rewrites with bounded memory while preserving serialized FIFO upstream requests and abort behavior
  • cover Gutenberg-style REST preflight and mutation forwarding through the corrected same-origin proxy contract

Fixes #2095

Evidence

  • Source relationship: fixes Preview proxy blocks Gutenberg editor saves on CORS preflight #2095 at the local preview proxy, where WordPress-generated absolute upstream URLs escaped the browser-visible proxy origin.
  • Change kind: bounded runtime proxy correction plus deterministic proxy/editor contract coverage.
  • Verification capability: the proxy test serves a chunk-split, JSON-escaped upstream REST URL, proves it becomes proxy-origin, forwards an OPTIONS request carrying x-http-method-override, and then completes the proxied REST mutation with its body and override header intact. Existing concurrency and aborted-request assertions remain in the same passing contract.
  • Scope: rewriting is limited to the proxy's exact configured upstream origin in identity-encoded textual bodies and response header values. It does not special-case Gutenberg, REST route names, or plugins, and it does not allow additional origins or headers. Encoded/binary responses and request forwarding remain unchanged.

Verification

  • TMPDIR=/tmp npm run test:browser-callback-materialization-contracts
  • TMPDIR=/tmp npm run test:editor-actions
  • npm run build
  • git diff --check

The editor test fixture was updated to include the runtime environment now required by the shared PHP bootstrap; no editor runtime behavior changed.

AI Assistance Disclosure

  • AI assistance: Yes
  • Tool(s): OpenCode and Homeboy
  • Model: openai/gpt-5.6-sol
  • Used for: Root-cause tracing, bounded proxy implementation, deterministic contract coverage, verification, and PR preparation. Chris Huber remains responsible for the submitted change.

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.

Preview proxy blocks Gutenberg editor saves on CORS preflight

1 participant