Comments (5)
项目使用 Golang 开发,打包生成的可执行文件可直接运行,无需使用 php。
没有使用过宝塔,建议服务器上看看redis-cli -h 127.0.0.1 -p 6379
是不是能正常连接,或者按照 README 中重新安装 Redis。后续版本将加入 Redis host port 自定义参数与 docker-compose 部署支持。
跨域问题的话,我线上使用nginx配置反向代理,前端请求没有问题。
server {
server_name example.com;
location / {
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://127.0.0.1:8002/;
}
}
from myurls.
很奇怪,我这边还是不行,我的配置是这样的
首先短链接使用 https://link.mfy.cool 作为域名
然后后端输入 ./myurls.service -domain https://link.mfy.cool -port 8001
使用8001端口
然后在宝塔的反向代理里面 反向代理http://link.mfy.cool:8001 -> http://link.mfy.cool
SSL证书已申请
然后在反向代理配置里面加入 add_header 'Access-Control-Allow-Origin' '*';
最后宝塔的反向代理配置如下:
#PROXY-START/
location /
{
proxy_pass http://link.mfy.cool:8001;
proxy_set_header Host link.mfy.cool;
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 'Access-Control-Allow-Origin' '*';
}
#PROXY-END/
前端的shortUrlbackend
配置为 https://link.mfy.cool
最后使用的时候发现还是报错跨域缺少Access-Control-Allow-Origin
我人傻了。。。完全不知道错在哪里,请大佬指教一下,万分感谢了!
from myurls.
from myurls.
from myurls.
如果是配合sub-web使用,由于修改了请求方式,前端需要更新到最新。
from myurls.
Related Issues (20)
- 大佬 能不能看下 sub-web 短链接获取失败 HOT 2
- vps arm不能启动amd正常 HOT 4
- 求MyUrls数据文件路径 HOT 2
- 如何将MyUrls接入sub-web HOT 4
- arm64的机子该如何采用docker的方式运行呢? HOT 9
- 搭建完成后,可以通过https访问前端页面,但是将长连接进行转换后,出现的是http的链接 HOT 2
- 构建docker编译出错 HOT 1
- docker版布署出错,大佬帮看看是什么问题 HOT 5
- 求自定义短链接后缀长度的方法? HOT 4
- 已实现后缀长度 3 位,但 API 获取还是 7 位,请问如何修改? HOT 2
- docker 部署失败 HOT 2
- 打扰一下大佬,部署后,获取的短链接始终无法打开
- 大大求救啊!!!docker使用时出现了无法连接redis的问题 HOT 7
- Easier Installation HOT 2
- Your Web Link Shortener Doesn't Work Anymore HOT 1
- Myurls启动成功了,但有其他问题
- 已经配置了正确的跨域,浏览器F12看还是报错 HOT 1
- 为啥那个backend不放到Docker的环境变量里 HOT 1
- 跨域 HOT 1
- 用npm反代 8080 端口不能改 改了就无法访问 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from myurls.