Blocked requests
Questi contenuti non sono ancora disponibili nella tua lingua.
When Protect blocks a request, the response looks the same whether it came from a web page, a fetch call or a mobile app. The Cloudflare Worker and AWS Lambda@Edge send the same response.
| Part | Value |
|---|---|
| Status | 403 |
X-Prosopo-Decision | block |
X-Prosopo-Request-Id | The ID of this request. Quote it to support so we can find the verdict. |
Retry-After | Only on a block that lifts by itself: the number of seconds until it does. Today that’s an app device going over its per-device rate limit. Other blocks don’t lift by themselves and don’t send it. |
Cache-Control | no-store |
A page load (a request that accepts HTML) gets the branded block page as the body. It shows the request ID as Reference: <id>, and the support form if you turned it on.
Every other request (fetch, XMLHttpRequest, app requests) gets JSON:
{ "error": "Access denied", "request_id": "…", "interstitial_branding": { … }}request_id is the same as X-Prosopo-Request-Id. interstitial_branding is your block page’s branding, which protect.js uses to draw the block page. Either field can be missing.
On cross-origin fetch calls, the edge lists X-Prosopo-Decision and X-Prosopo-Request-Id in Access-Control-Expose-Headers, so your page’s JavaScript can read them.
Telling a Protect block apart
Section titled “Telling a Protect block apart”Your own API can send 403 too. A response is a Protect block only when it has both status 403 and X-Prosopo-Decision: block. Header names are case-insensitive, so x-prosopo-decision is the same header.
A 401 with X-Prosopo-Status is not a block. It means the request needs a session or a challenge first. See Troubleshooting.
Web pages need nothing. A blocked page load shows the block page. When a fetch or XMLHttpRequest on a page running protect.js is blocked, protect.js shows the block page over your page.
Apps should:
- Check for a block before treating a
403as an error. Don’t show “check your internet connection” or a generic error. The person can’t fix that, and it hides why the app stopped working. - Not retry straight away. A block without
Retry-Afterstays in place. WithRetry-After, wait at least that many seconds. - Show the block page or your own message, with the request ID so the person can quote it to you or to our support form.
The SDKs do the detection for you:
- Android from 1.1.0:
ProsopoBlock.from(response)orconnection.block(), andblockHandling(BlockHandling.SHOW_PAGE)to open the block page automatically. See Android: Handle a block. - iOS from v0.2.0:
ProsopoBlock.from(response), andblockHandling: .showPageto open the block page automatically. See iOS: Handle a block.
The hosted block page
Section titled “The hosted block page”Apps on other platforms can show the same page. It’s served from your Protect endpoint:
https://protect.example.com/api/protect/blocked?rid=<request id>URL-encode the request ID, or leave out rid if the response had none. Open the page full screen in a WebView, with a way to close it. Its support form posts back to the same endpoint. The SDKs open this same URL.