开发者

Can I get Apache to alter Response Status Codes?

开发者 https://www.devze.com 2023-03-24 07:29 出处:网络
I have a load of services all using the same block of code and all incorrectly returning a 406 (Not acceptable) when what was really wanted was a 410 (Gone). The difference is not simply one of correc

I have a load of services all using the same block of code and all incorrectly returning a 406 (Not acceptable) when what was really wanted was a 410 (Gone). The difference is not simply one of correctness, but has other implications upstream as 410s can be cached and 406s can't.

In the long run all the underlying code is going to have to be altered and retested and it'll take time and money.

In the meanwhile it would be cool if I could simply alter all 406 responses to become a 410 as they pass through the Apache 2.2 front end.

Does anyone have a quick win for 开发者_运维知识库me here?

Thanks in advance.


This feels like a horrible hack but you could configure an error document for all 406 responses that itself sends a 410 status code:

ErrorDocument 406 http://yoursite.com/script-that-sends-410-status-code
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号