【问题标题】:Mixed Content, This request has been blocked; the content must be served over HTTPS , Laravel混合内容,此请求已被阻止;内容必须通过 HTTPS 提供,Laravel
【发布时间】:2020-03-31 06:10:12
【问题描述】:

我在生产环境中遇到此错误。仅在某些路线上,我认为有效的路线与少数无效的路线之间没有区别。我所有的路由都在 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

App/Providers/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

【问题讨论】:

  • 可以分享截图吗?
  • 我不确定,截图是什么?但我解决了这个问题,谢谢。

标签: laravel mixed-content laravel-7


【解决方案1】:

我找到了一个奇怪的解决方案。

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

【讨论】:

  • 那么可能是缓存问题。您的路线未正确缓存。
猜你喜欢
  • 2021-08-29
  • 2015-03-23
  • 2016-03-01
  • 2018-12-18
  • 2018-08-30
  • 2016-08-28
  • 1970-01-01
  • 1970-01-01
  • 2022-01-11
相关资源
最近更新 更多