lele-melis opened a new issue, #8851:
URL: https://github.com/apache/apisix/issues/8851
### Current Behavior
We're setting up a simple api gateway with openid authentication. While the
authentication flow is fine, and the API is accessed, we're seeing some
inconsistent behaviour with `Content-type` headers in the response when an
error condition occurs:
Missing routes have json content, but `Content-Type` is `text/plain`
```
> GET /missing-route HTTP/2
> Host: api.svcs.test
> user-agent: insomnia/2022.6.0
> accept: application/json
> content-type: application/json
< HTTP/2 404
< content-type: text/plain; charset=utf-8
{
"error_msg": "404 Route Not Found"
}
```
Unauthenticated requests for authenticated routes return html content (with
html `Content-Type`)
```
> GET /auth-test HTTP/2
> Host: api.svcs.test
> user-agent: insomnia/2022.6.0
> accept: application/json
> content-type: application/json
< HTTP/2 401
< content-type: text/html; charset=utf-8
<html....
```
### Expected Behavior
We would expect the `Content-Type` header to match the `Accept` in the
request, or at least be consistently `json`
### Error Logs
_No response_
### Steps to Reproduce
1. Run APISIX with the Docker image
2. Configure a route with the OpenID plugin
3. Hit the route without any `Authentication` header, and `Accept:
application/json`
4. See that the response is HTML
5. Hit a non existent route
6. The response looks like json, the `Content-Type` is `text/plain`
### Environment
- APISIX version (run `apisix version`): docker image:
apache/apisix:3.1.0-debian
- Operating system (run `uname -a`):
- etcd version, if relevant (run `curl
http://127.0.0.1:9090/v1/server_info`): 3.4.0 (docker image)
- APISIX Dashboard version, if relevant: 3.0.0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]