首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >请教,纯前端项目,如何解决代理访问 API 请求?

请教,纯前端项目,如何解决代理访问 API 请求?

提问于 2026-01-29 18:23:28
回答 1关注 0查看 82

想请教,由于前端项目在本地调试使用了代理转发第三方API,在 EdgeOne中有什么办法解决代理问题,否则生产环境有第三方API会有CORS问题。

类似于实现nginx代理转发的能力:

server {

listen 80;

server_name your-domain.com;

root /path/to/your/project/dist;

index index.html;

location / {

try_files $uri $uri/ /index.html;

}

# 代理 API 请求

location /api/dashscope {

proxy_pass https://dashscope.第三方.com;

proxy_set_header Host dashscope.第三方.com;

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;

}

}

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档