【问题标题】:Symfony RedirectResponse delete my custom headers headersSymfony RedirectResponse 删除我的自定义标头 headers
【发布时间】:2018-07-18 10:35:06
【问题描述】:

我正在做一个 symfony 应用程序,我在路由中有这个返回。

$response = new RedirectResponse($url, 302);

$response->headers->set(
    'Authorization', 'JWT ' . $this->jwt );

return $response;

问题是当我在浏览器上启动此代码时,响应中没有授权标头。

如果我在找到的同一条路线中使用 curl 启动,我会重新整理标题。我现在不知道原因。

【问题讨论】:

  • 你有没有尝试过这样的事情:` $response = new RedirectResponse($url, 302, $headers = array( 'Authorization' => 'JWT ' . $this->jwt ));返回$响应; `
  • 是但未找到,标头从不发送重定向

标签: symfony


【解决方案1】:

无法通过重定向发送自定义标头,请参阅Redirect to page and send custom HTTP headers 了解完整详情。

【讨论】:

    【解决方案2】:

    我没有解决问题,但我使用 cookie 发送 jwt

    【讨论】:

      猜你喜欢
      • 2020-09-28
      • 2020-04-19
      • 1970-01-01
      • 2017-06-09
      • 1970-01-01
      • 2020-08-14
      • 2011-08-23
      • 2013-08-11
      • 2013-06-24
      相关资源
      最近更新 更多