A 301 on your webhook URL can eat events and still show 200
A webhook is a way for one system to send another system an event, often by making an HTTP request to a registered URL. For a merchant, that can let a payment gateway notify the shop that a payment-related event occurred. The merchant’s server then needs to receive and process the request. In the article’s case, the gateway sent to a URL registered as HTTP. That URL later redirected to HTTPS. The sender followed the redirect, but some clients change a POST into a GET on a 301 or 302 and drop the body. The route returned homepage HTML with status 200, so the handler never ran. That is why a delivery status alone may not show whether the intended event was processed. The merchant registered the final HTTPS URL, made the route reject non-POST requests, and added alerts for GETs to webhook paths and hourly event-count differences. Comparing gateway and handler counts can reveal a gap.
What is a webhook, and how does it deliver an event to a merchant’s server?
A webhook is a way for one system to send another system an event, often by making an HTTP request to a registered URL. For a merchant, that can let a payment gateway notify the shop that a payment-related event occurred. The merchant’s server then needs to receive and process the request.
In the article’s case, the gateway sent to a URL registered as HTTP. That URL later redirected to HTTPS. The sender followed the redirect, but some clients change a POST into a GET on a 301 or 302 and drop the body. The route returned homepage HTML with status 200, so the handler never ran.
That is why a delivery status alone may not show whether the intended event was processed. The merchant registered the final HTTPS URL, made the route reject non-POST requests, and added alerts for GETs to webhook paths and hourly event-count differences. Comparing gateway and handler counts can reveal a gap.
How did the redirect let the gateway report a successful delivery even though the payment handler never ran?
A redirect can hide a failed handoff when the destination returns a success status for a request the webhook handler does not process. In this case, the gateway dashboard treated any 2xx response as success, and it did not check the response body. So a 200 did not prove the payment event had reached the right code.
The registered URL was an old HTTP address. After HTTPS was forced at the load balancer, that address returned a 301. The sender followed it, and many clients change POST to GET and drop the body on a 301 or 302. The GET reached the same route, where a catch-all returned 200 with the homepage HTML. The POST handler never ran.
The delivery log therefore showed “200, delivered” and did not retry. The fix was to register the final HTTPS URL, remove redirects from the path, and stop the catch-all from returning 200. Alerts now watch for GETs on webhook paths and compare sent and received event counts.
What can happen to a POST request’s method and body when a client follows a 301 or 302 redirect?
A POST request carries data in its body, which a webhook handler may need to process an event. When a client follows a 301 or 302 redirect, many clients switch the method to GET and drop that body. The behavior can therefore change what the destination receives, even though the sender followed the redirect.
That is what made the merchant’s case deceptive. The gateway had an old HTTP webhook URL, and the load balancer later redirected it to HTTPS with a 301. The sender followed the redirect. A GET then reached the route, and the route’s catch-all returned a 200 response with homepage HTML. The payment handler never received the POST body or ran.
Not every client necessarily behaves the same way, which is why the article warns against assuming how a sender handles redirects. The merchant removed redirects by registering the final HTTPS URL. The route now returns 405 for anything but POST, making an unexpected method visible instead of masking it as success.
How can comparing events sent by the gateway with events received by the handler show the scale of missed deliveries?
Comparing event counts gives a view beyond delivery status. If the gateway reports sending more events than the handler records receiving, the difference points to events that did not reach that handler during the measured period. It helps expose a gap that a dashboard can miss when it treats any 2xx response as success.
In the merchant’s case, the gateway marked every delivery 200, but orders never moved to paid. Redirected requests arrived as GETs, and a catch-all returned homepage HTML with 200. The handler did not run, so a successful-looking delivery response did not match the number of events actually received. The merchant added an alert on “events received vs. events sent” per hour.
This comparison shows the scale of a mismatch over time, rather than proving the cause by itself. The article does not give specific event totals or a measured count of missed deliveries. Pairing count monitoring with an alert for GET requests to webhook paths can help make this failure easier to spot.
How do 307 and 308 redirects differ from 301 and 302 when a request is POST?
For a POST request, the practical distinction is whether a redirect keeps the original request intact. The article notes that many clients change POST to GET and drop the body when following a 301 or 302. A 307 or 308 would preserve the method and body, so the redirected request can remain a POST carrying its event data.
The merchant’s problem began with an endpoint registered as HTTP. A later 301 sent the request toward HTTPS, and the sender followed it. The resulting GET hit a route whose catch-all returned 200 with homepage HTML. Because the handler did not run, the dashboard’s success status concealed the lost event.
Even though 307 or 308 would preserve method and body, the article cautions that merchants cannot assume the sender’s client handles redirects as expected. Its actual fix was to register the final HTTPS URL so no redirect sat in the path. That avoids depending on redirect behavior for webhook delivery.
Why should a webhook route reject GET requests with 405 instead of letting a catch-all return 200?
A webhook endpoint should not report a request as successful if it did not handle that request. Returning 405 to a GET makes the method mismatch visible in the response. By contrast, a catch-all that returns 200 can make an unintended request look like a successful delivery, even though the webhook logic did not process the event.
That is what happened after the sender followed a 301 from the old HTTP URL. Many clients switch POST to GET on a 301 or 302 and drop the body. The GET landed on the same route, and its catch-all returned 200 with homepage HTML. The dashboard counted the 2xx as success, so there was no retry and the handler never ran.
The merchant changed the route to answer 405 to anything but POST and removed the catch-all’s 200 response. This makes an unexpected GET harder to mistake for a processed event. An alert for GET requests to webhook paths adds another way to detect the problem.
What do HTTP methods and status codes tell a client about a request and its response?
HTTP methods and status codes describe different parts of an exchange. A method, such as GET or POST, tells the server what kind of request the client is making. A status code is the server’s response to that request. In ordinary HTTP use, 200 indicates success, 301 indicates a redirect, and 405 indicates that the method is not allowed for the resource.
The article’s webhook was meant to reach a POST handler. But after a 301 redirect, many clients can switch POST to GET and drop the body. The GET reached a catch-all route, which returned 200 with homepage HTML. The status described that response, not whether the payment handler processed the event. The dashboard counted any 2xx response as success.
The merchant changed the route to return 405 for anything but POST and removed the catch-all’s 200 response. That makes the method mismatch visible. Monitoring GETs to webhook paths and comparing events sent with events received can help reveal when responses and actual processing diverge.
This brief was written by AI from the original reporting and checked by other models. Names, figures and quotes come from the source; read it for full context.
Read more in the JupiteX app
Pulse is free. New stories every 4 hours, each one broken into the questions that explain it.
Or read more news on the web