简体   繁体   English

是否可以混淆或消除 Http 403 状态码

[英]Is it possible to obfuscate or eliminate Http 403 status code

A web developer reached out to me to inquire if I could prevent the 403 Forbidden status from showing on a Drupal site. web 开发人员联系我询问我是否可以阻止 403 禁止状态显示在 Drupal 网站上。 Of course I thought they just wanted a redirect to a 404 page or to the home page but that wasn't it.当然,我认为他们只是想要重定向到 404 页面或主页,但事实并非如此。 They wanted to know if I code make the 403 status code something else or prevent it from being sent to the browser.他们想知道我的代码是否将 403 状态代码设为其他内容或阻止将其发送到浏览器。

Example: When someone browses to mysite.com/contact, they are sent to mysite.com/homepage by default because of redirection as I changed the how ErrorDocument handles 403 and 404 errors in Apache.示例:当有人浏览到 mysite.com/contact 时,由于重定向,默认情况下他们被发送到 mysite.com/homepage,因为我更改了 ErrorDocument 如何处理 Apache 中的 403 和 404 错误。 However if you open devtools in any browser you can see that a 403 error is thrown.但是,如果您在任何浏览器中打开 devtools,您会看到抛出 403 错误。

The developer would like for that indication of the error code to be removed or replaced by something else.开发人员希望将错误代码的指示删除或替换为其他内容。 I am pretty sure it isn't possible but I have been wrong in the past so asking.我很确定这是不可能的,但我过去错了,所以问。 I have done some Googling and can't find anything to put me on the path to finding where that is generated server-side to see if I can manipulate it.我已经做了一些谷歌搜索,但找不到任何东西可以让我找到在服务器端生成的位置,看看我是否可以操纵它。 Any help would be appreciated as to find out if this is possible or not.任何帮助将不胜感激,以了解这是否可能。

I agree with you, it is not possible to "override" 403 and 404 at server-side level.我同意你的看法,不可能在服务器端“覆盖”403 和 404。 What it is possible is to override 403 and 404 error pages through twig template, but it is only a frontend option可以通过 twig 模板覆盖 403 和 404 错误页面,但这只是前端选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM