You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: header manipulation for DirectResponseAction
Description:
Our goal here is when we return an HTML file in a DirectResponseAction (i.e. a Forbidden page), to have it's content-type set to text/html. By default it's text/plain, rendering incorrectly in the browser. This could be done by setting the content-type response header but there is no way to specify response headers for just a DirectResponseAction that I can identify (proto struct). Another solution is to have Envoy infer the content-type for DirectResponseActions using the filesystem.
Currently, response headers can be modified at 1) the entire route configuration (doc), 2) the virtual host level (doc), or 3) in a single RouteAction (doc) which doesn't cover DirectResponseAction since they are "side-by-side".
Potential steps to resolve this are either
move the response_headers_to_add options from the RouteAction to the Route so that these options can apply regardless if the action is a RouteAction, DirectResponseAction, RedirectAction or any other future actions (preferred IMO but breaks the API)
Add response_headers_to_add options to DirectResponseAction, (and potentially) RedirectAction, and other future actions
Support the ability to detect content-type for DirectResponseAction based on filename extension if loading from file (easy but only solves a very narrow use-case, in this case ours)
This isn't a strict requirement we have to meet, but a feature that would be useful.
This adds the ability to specify response_headers_to_* and request_headers_to_add at the route level, for #3520
Risk Level: low
Testing: updated unit tests
Docs Changes: added
Fixes Issue: #3520
Signed-off-by: Derek Argueta <dereka@pinterest.com>
Title: header manipulation for DirectResponseAction
Description:
Our goal here is when we return an HTML file in a
DirectResponseAction
(i.e. a Forbidden page), to have it'scontent-type
set totext/html
. By default it'stext/plain
, rendering incorrectly in the browser. This could be done by setting thecontent-type
response header but there is no way to specify response headers for just aDirectResponseAction
that I can identify (proto struct). Another solution is to have Envoy infer the content-type forDirectResponseAction
s using the filesystem.Currently, response headers can be modified at 1) the entire route configuration (doc), 2) the virtual host level (doc), or 3) in a single RouteAction (doc) which doesn't cover DirectResponseAction since they are "side-by-side".
Potential steps to resolve this are either
response_headers_to_add
options from theRouteAction
to theRoute
so that these options can apply regardless if the action is aRouteAction
,DirectResponseAction
,RedirectAction
or any other future actions (preferred IMO but breaks the API)response_headers_to_add
options toDirectResponseAction
, (and potentially)RedirectAction
, and other future actionsDirectResponseAction
based on filename extension if loading from file (easy but only solves a very narrow use-case, in this case ours)This isn't a strict requirement we have to meet, but a feature that would be useful.
cc @rgs1 @brian-pane
The text was updated successfully, but these errors were encountered: