laravel - 混合内容,此请求已被阻止;内容必须通过 HTTPS 提供,Laravel

我在一个生产环境中遇到了这个错误。仅在某些路线上,我认为可行的路线和少数不可行的路线之间没有区别。我所有的路由都在 web.php 中,前面我尝试通过 Vuejs/Axios 访问。 此外,当我尝试访问它们时,这两个错误的 url 都会到达 https://,即使我尝试 http://,我也会重定向到 https。

到目前为止我尝试了什么。

.env

APP_URL=https://my.url

web.php

URL::forceScheme('https');  //at the top of the file

应用程序/提供商/AppServiceProvider

public function boot()
{
    URL::forceScheme('https');
}

还有:

composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan route:clear
php artisan config:cache
npm run prod

最佳答案

我发现了一个奇怪的解决方案。

我将路由名称从 random_question 更改为 random, Controller 方法名称 show 也更改为 random 并且有效。

https://stackoverflow.com/questions/60944415/

相关文章:

python - tf.data 与 tf.keras.preprocessing.image.Im

r - 为什么 ivreg 函数会产生奇怪的错误

r - 将 ggpredict() 和 ggplot2() 与缩放的连续变量一起使用并尝试取消缩放它

python-3.x - Python 3.8 将 "open"视为导入的 openpyxl 方法而

macos - MAC 上 .net 核心应用程序的核心签名 + 强化运行时

encryption - 为什么使用 JSON Web Tokens (JWT) 而不是普通加密

haskell - 使用 Haskell 从麦克风捕获音频输入?

angular - 如何使用 angular 在 s3 中使用带有多个文件的预签名 url

c# - TransactionScope 抛出异常 "This platform does not

python - 与另一个物体接触时改变物体颜色