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

Is there a way to customize body factory response headers? #10893

Open
nikolqy opened this issue Dec 1, 2023 · 2 comments
Open

Is there a way to customize body factory response headers? #10893

nikolqy opened this issue Dec 1, 2023 · 2 comments
Labels

Comments

@nikolqy
Copy link

nikolqy commented Dec 1, 2023

I am trying to customize an error document and I would like to change the content-type to text/plain, or remove the header completely. I don't mind modifying and recompiling it myself, but I feel like there must be some way to do this.

For example, with HAProxy, you can achieve similar behavior directly in the response bodies.

HTTP/1.1 403 go away
Content-Type: text/html

error msg

or like this for minimum response size

HTTP/1.1 403

error msg

Thanks!

@shukitchan
Copy link
Contributor

I think you can use a plugin to do that. Either

header_rewrite or lua will do -
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/header_rewrite.en.html
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/lua.en.html

You can have a handler for the "read response" hook in either case and simply override or remove the the client response header for "Content-Type".

@mingzym
Copy link
Member

mingzym commented Dec 23, 2023

etc/trafficserver/body_factory/default is that the error messages you looking for? I think you can define this as you wish at site wide config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants