如何强制 Laravel 项目对所有路由使用 HTTPS? [英] How to force Laravel Project to use HTTPS for all routes?
本文介绍了如何强制 Laravel 项目对所有路由使用 HTTPS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理一个需要安全连接的项目.
I am working on a project that requires a secure connection.
我可以通过以下方式设置路由、uri、资产以使用https":
I can set the route, uri, asset to use 'https' via:
Route::get('order/details/{id}', ['uses' => 'OrderController@details', 'as' => 'order.details', 'https']);
url($language.'/index', [], true)
asset('css/bootstrap.min.css', true)
但是一直在设置参数好像很累.
But setting the parameters all the time seems tiring.
有没有办法强制所有路由生成HTTPS链接?
Is there a way to force all routes to generate HTTPS links?
推荐答案
您可以设置 'url' =>
或者您可以使用中间件类 Laravel 5 - 重定向到 HTTPS.config/app.php
中的https://youDomain.com"
You can set 'url' => 'https://youDomain.com'
in config/app.php
or you could use a middleware class Laravel 5 - redirect to HTTPS.
这篇关于如何强制 Laravel 项目对所有路由使用 HTTPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文