More progress
This commit is contained in:
@@ -3,12 +3,13 @@ const https = require('https');
|
||||
|
||||
const HOST = 'localhost';
|
||||
const PORT = 3000;
|
||||
const MAX_REDIRECTS = 5;
|
||||
const MAX_REDIRECTS = 10;
|
||||
|
||||
function setCorsHeaders(res) {
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
||||
res.setHeader('Access-Control-Allow-Headers', '*');
|
||||
res.setHeader('Access-Control-Max-Age', '86400')
|
||||
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
||||
}
|
||||
|
||||
@@ -86,6 +87,9 @@ const server = http.createServer(async (req, res) => {
|
||||
)
|
||||
};
|
||||
|
||||
options.headers.host = parsedTarget.host;
|
||||
options.headers.origin = parsedTarget.origin;
|
||||
|
||||
// For POST and PUT methods, pass the body to the outgoing request
|
||||
if (req.method === 'POST' || req.method === 'PUT') {
|
||||
options.headers['Content-Length'] = Buffer.byteLength(body);
|
||||
|
||||
Reference in New Issue
Block a user