
An API accepts POST requests directly, but after adding a CDN it receives GET, returns 405, or reports an empty body. Capture every response in the redirect chain and check which layer issued Location and what the client sent on the next hop.
HTTPS enforcement, hostname normalization, trailing-slash rules, and login flows can all introduce redirects. Browser, SDK, and command-line behavior also depends on redirect settings and status codes. The final response alone can hide the hop that changed the request.
Understand which redirects preserve the method
| Status | Redirect type | What to check for POST |
|---|---|---|
| 301 | Permanent | Clients are permitted to change POST to GET; body preservation is not guaranteed. |
| 302 | Temporary | Clients are permitted to change POST to GET; verify the implementation. |
| 307 | Temporary | Automatic redirection must not change the request method. |
| 308 | Permanent | Automatic redirection must not change the request method. |
RFC 9110 Section 15.4 defines these semantics. A 303 normally directs the client to retrieve another resource with GET or HEAD. It can suit a form's result page, but it is not a method-preserving API redirect.
307 and 308 do not guarantee that the client can replay the body. Streaming uploads, non-rewindable request bodies, or client security policies can prevent following a redirect. For writes, also assess whether resending can cause duplicate execution.
Find the layer issuing Location
Record the original URL, method, client version, response status, Location, CDN request ID, and timestamp. Check HTTP-to-HTTPS redirects, hostname changes, API migrations, and trailing-slash normalization separately. A later 307 cannot restore a POST body that an earlier hop already dropped.
Compare CDN rules, origin proxy configuration, and application routes. Headers offer clues, but correlate them with logs rather than treating Server or Via as conclusive evidence. Inspect both the first-hop route and the destination in origin logs.
Reproduce on an isolated endpoint without following first
This Linux shell example is only for an authorized test endpoint. Even harmless-looking test data can trigger a side effect when submitted to a real API. Do not substitute an order, payment, or other production write endpoint.
curl -sS --max-time 15 \
-H 'Content-Type: application/json' \
--data-binary '{"probe":"redirect-check"}' \
-D first-hop.headers -o first-hop.body \
'https://api.example.com/test/redirect'
grep -Ei '^(HTTP/|location:|cache-control:)' first-hop.headerscurl does not follow redirects by default. Confirm that Location belongs to a trusted test destination before adding --location to inspect the chain. The endpoint should log each hop's method, body length, and correlation ID without retaining credentials or sensitive bodies.
Do not add -X POST and present that as evidence of ordinary browser or SDK behavior. An explicit method changes the test conditions and does not establish that the intended client preserves the body. When testing special curl options, record those options and the curl version separately.
Prefer the final HTTPS URL in client configuration
For APIs, uploads, and webhooks, configure the final scheme, hostname, path, and slash form directly where possible. This avoids a replay step. An HTTP-to-HTTPS redirect cannot undo exposure during an initial unencrypted request; clients should start with HTTPS.
For a temporary migration that must preserve methods, evaluate 307 after confirming client support and application semantics. For a permanent migration, evaluate 308. Apply rules by route rather than replacing every redirect site-wide: login pages, form result pages, and static resources can have different requirements.
Save the original rules, client target configuration, and rollback procedure. Test on a separate hostname or low-risk endpoint before expanding. Permanent redirects can be cached, so a trial rollout needs particular care.
Check credentials, cross-origin behavior, and replayability
A cross-origin redirect can encounter browser CORS checks or client restrictions on forwarding credentials. Preserving POST does not mean Authorization and Cookie will also be forwarded unchanged. Never force sensitive headers to arbitrary Location targets or use real credentials to test an uncontrolled redirect.
If the destination receives POST with an empty body, inspect whether the client can replay its upload stream, how the proxy handles the request body before redirecting, and whether the destination accepts the expected Content-Type and framing. Use isolated upload samples rather than repeatedly resending business files.
State-changing operations need server-side idempotency controls. After a timeout, redirect, or retry, check the original operation's result. A missing client response does not establish that the operation never executed.
Rule out a cached redirect
After changing a rule, clients may still follow an earlier cached permanent redirect. Check browser behavior, SDK policy, and CDN caching separately. Whether a redirect is stored depends on its status, cache directives, and platform configuration.
Compare a clean test client using the same controlled request. Purging the CDN does not clear client-side redirect history or stored responses. If invalidation is needed, scope it to the affected entry responses and verify whether the provider also touches redirect destinations. Avoid a global purge that creates unnecessary refill traffic.
Accept the fix based on the destination request
Record every hop's status and Location, the destination's actual method, body length and hash, authentication result, and business execution count. Cover the browser, deployed SDK versions, and actual upload mechanism.
If one 301 or 302 still changes POST to GET, correct that hop or configure clients to bypass it. Do not make the destination accept state-changing GET requests to conceal the redirect problem. Acceptance requires both successful delivery and evidence that the operation was not duplicated or sent with credentials to the wrong hostname.
References
Commands are isolated test examples and have not been executed against your production endpoints. Verify CDN rule priority, caching, and SDK behavior against the deployed platform configuration and client documentation.