2017-06-14 96 views
1

我有一个使用Symfony 3.2的应用程序,自昨天起运行良好。当我尝试访问应用程序时,我有一个BadRequestHttpException,它告诉我在我的请求中有两个冲突的http头:FORWARDEDX_FORWARDED_FORSymfony 3中http头之间的冲突

Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException (code: 
0):The request headers contain conflicting information regarding the origin 
of this request. at /home/biotekagee/gdpl/var/cache/prod/classes.php:4630, 

Symfony\\Component\\HttpFoundation\\Exception\\ConflictingHeadersException (code: 
0): The request has both a trusted \"FORWARDED\" header and a trusted 
\"X_FORWARDED_FOR\" header, conflicting with each other. You should either 
configure your proxy to remove one of them, or configure your project to 
distrust the offending one. at 
/home/biotekagee/gdpl/var/bootstrap.php.cache:1297 

事情我已经通知:

  • 的问题出现在生产environement。当使用DEV(app_dev.php)一切都很好
  • 所以我试图找到问题app.php,当我评论线$kernel = new AppCache($kernel)问题就解决了。我想,然后从HttpCache
  • 问题COM我没有使用任何代理
  • 清除缓存在所有

我一直在Symfony的工作没有帮助不到一年的我米仍然是一个noob,这个错误真的让我很紧张。我希望有人能够帮助我。

+0

https://github.com/contao/standard-edition/issues/45 – COil

+0

@COIL感谢您的链接,我发现了一些可以解决问题的东西,但它在您给我的问题中提到并不正确。仍然不知道问题出在哪里,我仍然不明白... – Matthew

回答

1

app.php

Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null); 

不能很好地解决第一个问题解决了,加入这一行......然后,我从Symfony的3.2更新到3.3的Symfony和问题似乎消失了。