Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否应使用协议相对URL指示静态资源 #778

Open
HisAtri opened this issue Mar 3, 2024 · 4 comments
Open

是否应使用协议相对URL指示静态资源 #778

HisAtri opened this issue Mar 3, 2024 · 4 comments

Comments

@HisAtri
Copy link

HisAtri commented Mar 3, 2024

关联 #317 静态资源应该使用相对URL,对于协议的判断不应由后端进行。

Nginx反向代理、CDN代理等都可能使得后端错判协议类型,导致Mixed Content错误,因此后端在非必要的情况下不应当直接指定协议。

使用href="//example.com"代替href="http://example.com"

实现:

{{ asset('css/app.css') }}

换为

{{ str_replace(['http:', 'https:'], '', asset('css/app.css')) }}
@gwL955
Copy link

gwL955 commented May 29, 2024

@HisAtri 大佬,这一句修改在哪个文件,愣是全局搜索都没找见

@HisAtri
Copy link
Author

HisAtri commented May 30, 2024

@HisAtri 大佬,这一句修改在哪个文件,愣是全局搜索都没找见

<link rel="stylesheet" href="{{ asset('css/app.css') }}?t=20220817">

@gwL955
Copy link

gwL955 commented Jun 2, 2024

@HisAtri 大佬,这一句修改在哪个文件,愣是全局搜索都没找见

<link rel="stylesheet" href="{{ asset('css/app.css') }}?t=20220817">

谢谢大佬,不过在修改之后会似乎会出现“419页面会话已超时”报错

@Willywang8216
Copy link

....... 好像沒處理.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants