Spaces:
Running
Running
File size: 718 Bytes
abed4cc 112d6b3 abed4cc d3426f9 cb08d9d 43f02ea 17ee36d 43f02ea 17ee36d 43f02ea 17ee36d 43f02ea 17ee36d 43f02ea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
const express = require('express');
const proxy = require('express-http-proxy');
const app = express();
const targetUrl = 'https://chatgpt.com/';
app.use('/', proxy(targetUrl, {
proxyReqPathResolver: (req) => {
return req.originalUrl;
},
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
// Установите заголовки, которые могут потребоваться для корректной работы сайта
proxyReqOpts.headers['Host'] = new URL(targetUrl).host;
proxyReqOpts.headers['Referer'] = targetUrl;
return proxyReqOpts;
},
}));
const port = 7860;
app.listen(port, () => {
console.log(`Сервер запущен на порту ${port}`);
}); |