Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New proxy attribute: unexpected_status #831

Open
johakoch opened this issue Jun 29, 2024 · 0 comments · May be fixed by #835
Open

New proxy attribute: unexpected_status #831

johakoch opened this issue Jun 29, 2024 · 0 comments · May be fixed by #835

Comments

@johakoch
Copy link
Collaborator

Implement a new attribute for the proxy block: unexpected_status.

Use case: see discussion #723.

Especially if the proxy block is within wildcard endpoint block

endpoint "/**" {
  proxy {
    backend = "api_backend"
  }
}

all sorts of valid status codes can occur due to the endpoint proxying to potentially a lot of backend API endpoints.

So if you want to react to a specific error status code, e.g. 401, with an error_handler "unexpected_status" and proxy all other responses, you cannot use the expected_status attribute. Here, an unexpected_status attribute would come in handy:

endpoint "/**" {
  proxy {
    backend = "api_backend"
    unexpected_status = [401]
  }

  error_handler "unexpected_status" {
    # try to get a fresh token
  }
}

Should the new attribute be mutually exclusive with expected_status?

I don't think that the other block types that have expected_status (request, beta_token_request, health) would profit from an unexpected_status attribute. All three are usually used for specific requests, where only a very limited set of status codes are treated as valid.

@johakoch johakoch linked a pull request Jul 9, 2024 that will close this issue
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 a pull request may close this issue.

1 participant