const http = require('http'); const httpProxy = require('http-proxy'); // Replace with your actual Kharej server address const TARGET = 'http://172.86.93.204.sslip.io:8080'; const proxy = httpProxy.createProxyServer({ target: TARGET, ws: true, changeOrigin: true }); proxy.on('error', function(e) { console.log('Proxy error:', e); }); const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('AI chatbot is running!'); }); server.on('upgrade', (req, socket, head) => { proxy.ws(req, socket, head); }); // Huggingface Spaces explicitly exposes port 7860 to the outside world server.listen(7860, () => { console.log('Proxy running on port 7860'); });