采用HTTPS协议时 浏览器报错
sandersyao opened this issue · 2 comments
sandersyao commented
在创建目录或者上传文件的时候chrome浏览器报错类似以下文案:
Mixed Content: The page at 'https://mydomain/admin/media' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://mydomain/admin/media/upload'. This request has been blocked; the content must be served over HTTPS.
大概原因如下:
在发送AJAX请求的时候浏览器阻止了从HTTPS向“非安全协议”HTTP地址的请求,所以简单的来说就是form表单的action属性的协议部分写错了,换成HTTPS协议即可,但是没有找到能够配置的地方。
建议添加协议配置项或者直接去掉协议头使用 //mydomain/admin/media/upload 这样路径作为action属性。
sandersyao commented
MediaManager.php:167-171
167 'index' => str_replace('http:', '', route('media-index')),
168 'move' => str_replace('http:', '', route('media-move')),
169 'delete' => str_replace('http:', '', route('media-delete')),
170 'upload' => str_replace('http:', '', route('media-upload')),
171 'new-folder' => str_replace('http:', '', route('media-new-folder')),
我是这样解决的
z-song commented
参考一下 z-song/laravel-admin#1780 和 z-song/laravel-admin#1644 这两个问题