Hi, Yes the purpose is only to write the correct reason for a given status code.
In some systems there are custom status code that are unknown. That is when setting reasons can be useful.
Best, Bowen On 7/29/15 9:35 PM, Willy Tarreau wrote:
Hi, On Tue, Jul 28, 2015 at 02:57:46PM -0700, Bowen Ni wrote:Hi, I'm submitting a patch that allows rewriting the HTTP response status code and reason phrase. There are two new keywords in 'http-response' that allows you to rewrite them in the native HAProxy config. There are also two new APIs in Lua that allows you to do the same rewriting in your Lua script. Example: Use it in HAProxy config: *http-response set-code 404* Or use it in Lua script: *txn.http:res_set_reason("Redirect")*What is the real purpose of changing the reason ? I see for the status, but the reason ? The reason was removed from HTTP/2 because it's not used, so this rule will simply be ignored on HTTP/2 traffic. If the purpose is only to write the correct reason for a given status code, then I'd rather have a patch with a switch/case covering all known statuses with their fallbacks and emits the corresponding reason. It would be easier to use as set-status would simply set the status and the reason would automatically be adjusted. Thanks, Willy

