one-api / new-api 设计不当导致泄露源站IP
在使用图片URL请求,不论模型,一律会泄露 one-api / new-api 部署服务器的源IP。
因为服务器会试图去获取图片信息,而且只是简单使用 http.Get
和 http.Head
,导致 100% 泄露源站IP。
这两天整个互联网都在被DDoS搅得天昏地暗,你懂服务器源IP泄露的后果吧?
解决方案是使用代理请求用户提供的图片地址。
linux-do/new-api 已更新代理设置,速速更新!更新后可以设置成自己的代理,用以隐藏服务器IP地址:
测试代码:
curl https://your-new-api-domain/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What'\''s in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "https://your-domain/test.jpg"
}
}
]
}
],
"max_tokens": 300
}'
上面代码设置了一个 https://your-domain/test.jpg
图片地址,这个请求发送给API服务器,它会请求 https://your-domain/test.jpg
你就能看到它的真实IP了。