You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "csuhta (via GitHub)" <gi...@apache.org> on 2026/07/16 07:02:09 UTC

[I] Can't find a way to serve JSON errors [trafficserver]

csuhta opened a new issue, #13393:
URL: https://github.com/apache/trafficserver/issues/13393

   We want to use ATS to protect a JSON API and image origin, we want all error messages to be returned as JSON to the client. We are also using HRW4U. It doesn't seem possible to configure ATS to return anything other than very simple HTML responses
   
   In Header Rewrite rules:
   
   - Inside `REMAP {…}`, `http.status = 400` automatically changes the `Content-Type` to `text/html`
   - Inside `REMAP {…}`, `inbound.resp.body` can't be set to anything other than basic text. It also doesn't seem possible to place quotes or newlines in this string?
   - Inside `REMAP {…}`, `inbound.resp.Content-Type` isn't supported, why can I set the body but not this header?
   - `set-body-from` is only supported inside `READ_RESPONSE {…}`, where it replaces a potentially cached item
   
   In addition, I cannot find any way to get `body_factory` to produce JSON documents in places where ATS responds with its own errors, it's always `text/html`
   
   Am I completely missing something? Is there a way to send JSON when you want to return a 4XX or 5XX error?


-- 
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: issues-unsubscribe@trafficserver.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can't find a way to serve JSON errors [trafficserver]

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on issue #13393:
URL: https://github.com/apache/trafficserver/issues/13393#issuecomment-4993723835

   I am not sure how HRW4U plays into this, but this is a known limitation of header_rewrite.


-- 
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: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can't find a way to serve JSON errors [trafficserver]

Posted by "csuhta (via GitHub)" <gi...@apache.org>.
csuhta commented on issue #13393:
URL: https://github.com/apache/trafficserver/issues/13393#issuecomment-4996515840

   > I am not sure how HRW4U plays into this
   Sorry, I was just mentioning that before I showed my examples in HRW4U syntax


-- 
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: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can't find a way to serve JSON errors [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt closed issue #13393: Can't find a way to serve JSON errors
URL: https://github.com/apache/trafficserver/issues/13393


-- 
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: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can't find a way to serve JSON errors [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on issue #13393:
URL: https://github.com/apache/trafficserver/issues/13393#issuecomment-5037147846

   Looks tightly related to issues discussed here:
   https://github.com/apache/trafficserver/issues/11480


-- 
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: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org