Shiro
Shiro copied to clipboard
无法评论&友链无法显示
Describe the bug
部署后遇到以下情况:
1.无法评论(无论是否登录都显示下图内容)
显示"[POST] "https://blog.xxx.com/api/v2/comments/66287afbce947093dee45db1": Failed to fetch"
2.友链无法显示(已在后台添加)
docker部署后端,vercel部署前端
Reproduction
后台只有一条数据
System Info
Error response from daemon: No such container: e50fa30b36bd54b74fbd643f73fab34e79431df6783c21fffd4
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.
感觉是你配置问题, 跨域了
你好,请问解决了吗,我也遇到了同样的问题
我也是这个问题。docker后端+docker前端。
我也是这个问题。docker后端+docker前端。
我是这样解决的,看最后一部分。https://www.beanljun.top/posts/play/shiro
我也是这个问题。docker后端+docker前端。
我是这样解决的,看最后一部分。https://www.beanljun.top/posts/play/shiro
不行因为我没有用到cf等。我是直接在本地群晖dokcer部署了后端和前端,我用内网环境也是会出现这个问题,今天尝试一下用vps部署一下试试
而且我目前在前端登录轻管理也是登录不进去。可能这个项目不适合本地部署?或者就是反代有问题?
我通过单域名反向代理解决了,但是我现在有俩问题,第一个时间线没有,第二个个人状态展示添加了函数但是没起作用,
我也出现这个问题,有解决的方法吗?
我也出现这个问题,有解决的方法吗?
跨域了,按照大佬的单域名的教程来反代和安装就行了
请问有教程吗?我小白
请问有教程吗?我小白
按照作者大佬的教程走,单域名配置。
能给个参考网址嘛!谢谢啦!
能给个参考网址嘛!谢谢啦!
https://mx-space.js.org/themes/shiro
我就是按照这个教程来的,还是出现了这个问题
我就是按照这个教程来的,还是出现了这个问题
看下后端 docker-compose.yml environment 字段里, ALLOWED_ORIGINS 有没有填上前端的域名
谢谢您的回复,但写了这个,还有解决的方法吗?
解决了,谢谢各位的回复!
啊哈,通过nginx配置文件解决了
我在docker中分别部署了mx-space和shiro,通过修改nginx反向代理配置解决了此问题
这个是我的配置文件提供参考,仅作反向代理配置示例
详细请参考这篇文章 跨域问题
啊哈,通过nginx配置文件解决了
我在docker中分别部署了mx-space和shiro,通过修改nginx反向代理配置解决了此问题
这个是我的配置文件提供参考,仅作反向代理配置示例
一键复制,详细请参考这篇文章 跨域问题
#PROXY-START/
location ^~ /socket.io {
proxy_pass http://127.0.0.1:2333/socket.io;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_http_version 1.1;
add_header Cache-Control no-cache;
# 添加CORS头部信息
if ($http_origin ~* "https?://(www\.)?(eell\.pro)$") {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, x-session-uuid, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Range' always;
}
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, x-session-uuid, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Range' always;
add_header 'Content-Length' 0 always;
add_header 'Content-Type' 'text/plain; charset=UTF-8' always;
return 204;
}
}
location ^~ / {
proxy_pass http://127.0.0.1:2333;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
# 添加CORS头部信息
if ($http_origin ~* "https?://(www\.)?(eell\.pro)$") {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, x-session-uuid, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Range' always;
}
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, x-session-uuid, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Range' always;
add_header 'Content-Length' 0 always;
add_header 'Content-Type' 'text/plain; charset=UTF-8' always;
return 204;
}
}
#PROXY-END/