Skip to content

Remove hand-coded 829 error section#208

Draft
sihugh wants to merge 1 commit intomainfrom
error-handling
Draft

Remove hand-coded 829 error section#208
sihugh wants to merge 1 commit intomainfrom
error-handling

Conversation

@sihugh
Copy link
Contributor

@sihugh sihugh commented Sep 12, 2025

The terraform that generates our edge-rate limiting is the only thing that generates 829 errors in our VCL. The terraform also generates code that handles the errors. It's in the "complete VCL" in the Fastly console, and looks a bit like this:

"# Snippet rate-limiter-v1-someid-error-error : 100
"# Begin rate-limiter rate_limiter error
  if (obj.status == 829 && obj.response == "Rate limiter: Too many requests for someid") {
    set obj.status = 429;
    set obj.response = "Too Many Requests";
    set obj.http.Content-Type = "plain/text";
    synthetic.base64 "VG9vIG1hbnkgcmVxdWVzdHM=";
    return(deliver);
  }

First terraform-generated section

Screenshot 2025-09-12 at 09 56 03

Second terraform-generated section

Screenshot 2025-09-12 at 09 57 42

Our code that I'd like to remove

Screenshot 2025-09-12 at 09 58 01

It's notable that we set a Fastly-Backend-Name that, I think should appear in the origins inspector along with the S3 buckets, but doesn't. I'm taking this as being further evidence that this isn't a code path that's executed.

If we wanted to examine this further, we could possibly instrument this section in some way, or use a "beacon" in the markup that we send back.

The terraform that generates our edge-rate limiting is the only thing that generates 829 errors in our VCL. The terraform also generates code that handles the errors. It's in the "complete VCL" in the Fastly console, and looks a bit like this:

```
"# Snippet rate-limiter-v1-someid-error-error : 100
"# Begin rate-limiter rate_limiter error
  if (obj.status == 829 && obj.response == "Rate limiter: Too many requests for someid") {
    set obj.status = 429;
    set obj.response = "Too Many Requests";
    set obj.http.Content-Type = "plain/text";
    synthetic.base64 "VG9vIG1hbnkgcmVxdWVzdHM=";
    return(deliver);
  }
```

There are two of these sections at the moment, in addition to the section I'm removing here.

It's notable that we set a `Fastly-Backend-Name` that, I think should appear in the origins inspector along with the S3 buckets, but doesn't. I'm taking this as being further evidence that this isn't a code path that's executed.

If we wanted to examine this further, we could possibly instrument this section in some way, or use a "beacon" in the markup that we send back.
@sihugh sihugh requested a review from samsimpson1 September 12, 2025 09:02
@AgaDufrat
Copy link
Contributor

Converting to Draft until it's ready to be merged so it's not flagged by the Seal.

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.

3 participants