| const http = require('http'); |
| const httpProxy = require('http-proxy'); |
|
|
| |
| 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); |
| }); |
|
|
| |
| server.listen(7860, () => { |
| console.log('Proxy running on port 7860'); |
| }); |