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

ext_authz is called before host redirect is performed #4640

Closed
LanceEa opened this issue Oct 21, 2022 · 1 comment
Closed

ext_authz is called before host redirect is performed #4640

LanceEa opened this issue Oct 21, 2022 · 1 comment
Assignees
Labels
cycle 6 t:bug Something isn't working

Comments

@LanceEa
Copy link
Contributor

LanceEa commented Oct 21, 2022

Summary

In Envoy 1.20+ the ext_authz behavior changed so Envoy makes ext_authz calls on all request (redirect, route, direct response) unless overridden on a per Route basis. In Emissary-ingress v3.Y, when an AuthService is applied this behavior change caused Envoy to call the AuthService before performing the host_redirect. This issue is related to the #4620 which the same behavior change caused https_redirect to not work properly.

When using a Mapping and you set the host_redirect: true field the the following Envoy configuration is produced:

{
  "match": {
    "case_sensitive": true,
    "headers": [
      {
        "exact_match": "https",
        "name": "x-forwarded-proto"
      }
    ],
    "prefix": "/backend/",
  },
  "redirect": {
    "host_redirect": "quote.default",
    "path_redirect": "/bob/"
  }
}

In previous versions of Emissary-ingress the redirect caused Envoy to skip the ext_authz call but that is no longer the default behavior.

Proposed Solution

We need to implement the same solution we did for https_redirect so that we override this behavior on a per-route basis to restore the behavior that existing prior to Emissary-ingress v3.Y.

Here is a sample of what the fixed configuration should look like:

{
  "match": {
    "case_sensitive": true,
    "headers": [
      {
        "exact_match": "https",
        "name": "x-forwarded-proto"
      }
    ],
    "prefix": "/backend/"
  },
  "redirect": {
    "host_redirect": "quote.default",
    "path_redirect": "/bob/"
  },
  "typed_per_filter_config": {
    "envoy.filters.http.ext_authz": {
      "@type": "type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute",
      "disabled": true
    }
  }
}
@LanceEa LanceEa added t:bug Something isn't working cycle 6 labels Oct 22, 2022
@LanceEa LanceEa self-assigned this Oct 22, 2022
@LanceEa LanceEa changed the title host redirect issue ext_authz is called before host redirect is performed Oct 22, 2022
@LanceEa
Copy link
Contributor Author

LanceEa commented Nov 1, 2022

Closed by #4641

@LanceEa LanceEa closed this as completed Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cycle 6 t:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant