Make Chrome display pages even on 500 or 404 codes

2020-05-27 04:24发布

We're developing a new site in Symfony. When Symfony encounters an error, such as a "no route found", and debug is set to true, it not only outputs a 404 code, it actually shows the error on the page. Firefox displays what the server returned, but Chrome does not.

For my no route found example:

Firefox shows this: http://i.imgur.com/myF85Sl.png
Chrome shows this: http://i.imgur.com/hex19In.png

Is there a way to get Chrome to behave like Firefox under these conditions?

Edit: There seems to be some questioning of what's actually happening. I don't know what's causing this, otherwise I would fix it. Here's what I see in the Chrome network inspector (note that this image is for a 500 error, but the same happens with 404's): http://i.imgur.com/VIOWGRy.png

Notice the content length of zero. If I go to the exact same URL through Firefox (same server, everything), it shows the actual Symfony error.

2条回答
ゆ 、 Hurt°
2楼-- · 2020-05-27 04:31

Under the monolog config in your config_dev.yml, remove the firephp/chromephp sections.

查看更多
▲ chillily
3楼-- · 2020-05-27 04:41

There is a bug report raised for this:

Issue 1695: Chrome needs option to turn off "Friendly 404" displays

According to the comments on that issue, if the server error page is more than 512 bytes, then it gets displayed correctly.

That said, I can't actually reproduce the problem, so I'm not sure if that workaround actually fixes it.

查看更多
登录 后发表回答