Comments (4)
我傻了,在location v1里把那个sk认证那一行注释掉,在index设置接口和sk默认值就能实现需求了。
但是还是很好奇有没有能够不在前端暴露sk的方法。
from chatgpt-web.
首先,nginx如果html跟反代接口在同一路径,比如html在location /,反代接口在location ^~/v1,前端是不用再配置自定义接口和自定义api的,可以直接用
而如果不在同一路径,前端才需要配置自定义接口和自定义api,比如readme里的第一种使用方法(html跟接口可以不在同一个域名下,只要接口允许跨域)
from chatgpt-web.
首先,nginx如果html跟反代接口在同一路径,比如html在location /,反代接口在location ^~/v1,前端是不用再配置自定义接口和自定义api的,可以直接用
而如果不在同一路径,前端才需要配置自定义接口和自定义api,比如readme里的第一种使用方法(html跟接口可以不在同一个域名下,只要接口允许跨域)
还真是,谢谢您啦!
不过还是想确认一下,是不是任何人调用example.com/v1/就相当于用了服务器存储的apikey来访问openai的接口?不懂nginx QAQ
from chatgpt-web.
首先,nginx如果html跟反代接口在同一路径,比如html在location /,反代接口在location ^~/v1,前端是不用再配置自定义接口和自定义api的,可以直接用
而如果不在同一路径,前端才需要配置自定义接口和自定义api,比如readme里的第一种使用方法(html跟接口可以不在同一个域名下,只要接口允许跨域)还真是,谢谢您啦! 不过还是想确认一下,是不是任何人调用example.com/v1/就相当于用了服务器存储的apikey来访问openai的接口?不懂nginx QAQ
是的,你可以把接口加个basic_auth
from chatgpt-web.
Related Issues (20)
- 大佬可以优化一下Windows、安卓手机的兼容性吗 HOT 7
- 代码块样式问题
- 暴露接口 和 API KEY HOT 1
- I18n support HOT 1
- 想简单的自动保存进数据库怎么弄呢? HOT 1
- 语音功能丢失! HOT 10
- Vercel deployment
- 怎么开启默认角色。自定义一个默认的角色 HOT 1
- 返回的文本不能换行,请问怎么换行实现呢,\n 和<br>标签都没用 HOT 1
- 请教,在后端返回的数据流是完整的输出流,但是页面回答的内容处确中断了输出,没有报错,请问可能是什么原因造成的呢 HOT 7
- 微信打开网页,麦克风输入问题 HOT 3
- 可以付费请作者二开吗 HOT 1
- 引用文件cdn出现问题 HOT 2
- 小白求教我想隐藏左下角那个自定义输入接口的地址应该怎么样改代码呀
- 在vercel.com部署的 api key报错
- 打字机速度调慢后仅生效一次 HOT 1
- css和js提示跨域限制,请问怎么解决? HOT 2
- 大神好!希望能夠支持Gemini Pro HOT 3
- 是否能支持重试?
- 语音输入问题 HOT 6
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 chatgpt-web.