mirror of
https://github.com/praveentcom/openproxy.git
synced 2026-05-26 09:47:46 +02:00
Enhance logging and update README for SSRF warning
- Updated console log messages in cost.ts and proxy.ts for clarity and consistency. - Added important SSRF warning in README.md regarding localhost access issues with certain clients, along with solutions using external proxy services.
This commit is contained in:
@@ -281,6 +281,7 @@ async function persistDatabaseRecord(data: Record<string, any>) {
|
||||
*/
|
||||
const server = http.createServer(async (req: IncomingMessage, res: ServerResponse) => {
|
||||
const startTime = Date.now();
|
||||
console.log(`[\x1b[30m${new Date().toISOString()}\x1b[0m] \x1b[93m${req.method} \x1b[0m\x1b[94m${req.url}\x1b[0m`);
|
||||
try {
|
||||
const url = new URL(req.url || "/", `http://${req.headers.host}`);
|
||||
const path = url.pathname;
|
||||
@@ -483,10 +484,10 @@ async function startServer() {
|
||||
await loadHeliconeCosts();
|
||||
|
||||
server.listen(PORT, () => {
|
||||
console.log(`\n\x1b[32mOpenProxy upstream connections activated ⟣⟢\x1b[0m\n`);
|
||||
console.log(`\n\x1b[32mOpenProxy ready... ⟣⟢\x1b[0m\n`);
|
||||
|
||||
if (OPENAI_UPSTREAM_URL) console.log(`\x1b[34m 📡 http://localhost:${PORT}/openai/* → ${OPENAI_UPSTREAM_URL}\x1b[0m`);
|
||||
if (ANTHROPIC_UPSTREAM_URL) console.log(`\x1b[34m 📡 http://localhost:${PORT}/anthropic/* → ${ANTHROPIC_UPSTREAM_URL}\x1b[0m\n`);
|
||||
if (OPENAI_UPSTREAM_URL) console.log(`\x1b[94m 📡 http://localhost:${PORT}/openai/* → ${OPENAI_UPSTREAM_URL}\x1b[0m`);
|
||||
if (ANTHROPIC_UPSTREAM_URL) console.log(`\x1b[94m 📡 http://localhost:${PORT}/anthropic/* → ${ANTHROPIC_UPSTREAM_URL}\x1b[0m\n`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user