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

Content-Type from Auth service is overwritten in error response #5484

Open
iam-nagarajan opened this issue Dec 14, 2023 · 1 comment
Open
Labels
t:feature New feature or enhancement request

Comments

@iam-nagarajan
Copy link

iam-nagarajan commented Dec 14, 2023

Content-Type from Auth service is overwritten in error response

To Reproduce
Setup AuthService

---
apiVersion: getambassador.io/v3alpha1
kind: AuthService
metadata:
  name: authentication
spec:
  ambassador_id: ["--apiVersion-v3alpha1-only--default"]
  auth_service: "mockserver.default:8080"
  path_prefix: "/ambassador"
  proto: http
  timeout_ms: 5000
  status_on_error:
    code: 500
  failure_mode_allow: false
  allowed_authorization_headers:
  - "x-test"

The mockserver is configured to authenticate the requests and for invalid requests it'll send the response body like below with 403 status code and Content-Type set as application/json

{
  "result" : "Forbidden"
}

When we call the API through emissary, it overrides the Content-Type as text/plain from application/json

HTTP/1.1 403 Forbidden
Content-Type: text/plain
... <other headers>
{"result":"Forbidden"}

Expected behavior
The auth failure response should retain original Content-Type

HTTP/1.1 403 Forbidden
Content-Type: application/json
... <other headers>
{"result":"Forbidden"}

Versions (please complete the following information):

  • Ambassador: 3.9.1
  • Kubernetes environment AWS EKS
  • Version 1.27
@cindymullins-dw
Copy link
Contributor

text/plain is the default. You can set the content_type for custom error responses on either a Module or a Mapping. I'm not sure if that spec is available on the AuthService but it might be something to try.

@cindymullins-dw cindymullins-dw added the t:feature New feature or enhancement request label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:feature New feature or enhancement request
Projects
None yet
Development

No branches or pull requests

2 participants