3

laravel 重定向 https 变 http 问题

 1 year ago
source link: https://www.v2ex.com/t/865579
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  PHP

laravel 重定向 https 变 http 问题

  exqibao · 1 小时 28 分钟前 · 206 次点击

最近搭了一个 mc 的开源皮肤站(blessing-skin-server),使用了一段时间发现登录后清楚浏览器缓存,刷新页面会回到登录页面,登录回跳转到原来的地址,但是 https 变成了 http 。在 github 上提了问题,但还没大佬回Github 上提的问题

  • blessing-skin-server
  • nginx
server {
    listen 443 ssl http2;
    server_name blessing-skin.***.***;
    location / {
        proxy_pass http://172.17.0.1:57236;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

发现这个地方记录登录前的 url 地址的'last_requested_path' => $request->fullUrl(),,自己试过用 replace 把 http 变 https 是可以,但需要改代码,更新可能就覆盖回来了。

blessing-skin-server是有一个.env文件的,期望能通过修改.env或者nginx.conf配置实现$request->fullUrl()获取到 https 的地址,正常跳转到 https 的地址上。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK