unexpected status 404 Not Found: CC Switch local proxy failed while handling Cod...
错误信息
unexpected status 404 Not Found: CC Switch local proxy failed while handling Codex endpoint /responses. Provider: gpt-5.6-luna-cdx; model: gpt-5.6-luna; upstream_status: HTTP 404; cause: Invalid URL (POST /v1), url: http://127.0.0.1:15721/v1/responses
AI 解决方案
🔍 报错分析
1. 🌐 错误翻译
原文:unexpected status 404 Not Found: CC Switch local proxy failed while handling Codex endpoint /responses. Provider: gpt-5.6-luna-cdx; model: gpt-5.6-luna; upstream_status: HTTP 404; cause: Invalid URL (POST /v1), url: http://127.0.0.1:15721/v1/responses
译文:意外状态码 404 未找到:在处理 Codex 端点 /responses 时,CC Switch 本地代理失败。服务商:gpt-5.6-luna-cdx;模型:gpt-5.6-luna;上游状态:HTTP 404;原因:无效 URL (POST /v1),URL:http://127.0.0.1:15721/v1/responses
2. 🎯 原因分析
/v1/responses,但本地代理服务器在 127.0.0.1:15721 端口并未正确配置匹配该路径的接口,或代理路由规则配置有误,无法将 /v1/responses 正确转发至上游服务。3. 💡 解决方案
检查本地代理服务器的路由配置,确保能正确处理
/v1/responses 路径的 POST 请求,指向对应服务商的真实接口地址。以下是一个示例的本地代理路由修复配置(以 Node.js Express 为例):const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const app = express();
// 修复代理路由,正确转发 /v1/responses 请求
app.use('/v1', createProxyMiddleware({
target: 'https://api.provider.com', // 替换为实际服务商的API基础地址
changeOrigin: true,
pathRewrite: {
'^/v1': '/v1' // 保持路径一致,或根据服务商需求调整
},
onProxyReq: (proxyReq, req, res) => {
// 确保 POST 请求正确处理
if (req.method === 'POST') {
proxyReq.setHeader('Content-Type', 'application/json');
}
}
}));
app.listen(15721, () => {
console.log('Local proxy is running on http://127.0.0.1:15721');
});