且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 5.6签名的URL在APP_ENV = production中不起作用

更新时间:2023-08-22 22:10:40

我有一个类似的问题-如果您使用TrustedProxy中间件,则可以很容易地解决它.

I had a similar problem - it can be solved very easy if you use the TrustedProxy Middleware.

如果您在负载均衡器后面的Heroku或AWS上,并且您已将SSL卸载到负载均衡器,则可能需要信任所有代理,以便Laravel的请求可以检测到您实际上在SSL连接上. 然后签名URL验证将起作用.

If you are on Heroku or AWS behind Load Balancers, and you have SSL offloaded to load balancers, you might want to Trust all proxies, so that Laravel's Request can detect that you are actually on a SSL connection. Then Signed URL Validation will work.

您可以在此处查看doku:
Laravel 5.7 https://laravel.com/docs/5.7/requests#configuring-trusted -代理
Laravel 5.6 https://laravel.com/docs/5.6/requests#configuring-trusted -代理

You can see the doku here:
Laravel 5.7 https://laravel.com/docs/5.7/requests#configuring-trusted-proxies
Laravel 5.6 https://laravel.com/docs/5.6/requests#configuring-trusted-proxies