Open
Description
Currently the preflight request is served with correct CORS headers for given origin, but the proxied request response is passed without them.
Would it be possible to use the CORS middleware on proxied requests too?
{
'server.request': {
requestId: 1,
method: 'OPTIONS',
url: '/api/x',
headers: {
host: 'localhost:8000',
connection: 'keep-alive',
'access-control-request-method': 'GET',
'sec-fetch-mode': 'cors',
'access-control-request-headers': 'authentication-token',
origin: 'http://localhost:3000',
'sec-fetch-site': 'same-site',
referer: 'http://localhost:3000/settings',
}
}
}
{
'server.response': {
requestId: 1,
statusCode: 204,
headers: [Object: null prototype] {
vary: 'Origin',
'access-control-allow-origin': 'http://localhost:3000',
'access-control-allow-credentials': 'true',
'access-control-allow-methods': 'GET,HEAD,PUT,POST,DELETE,PATCH',
'access-control-allow-headers': 'authentication-token'
}
}
}
{
'server.request': {
requestId: 2,
method: 'GET',
url: '/api/x',
headers: {
host: 'localhost:8000',
connection: 'keep-alive',
'sec-ch-ua': 'Chromium 78',
'sec-fetch-mode': 'cors',
'authentication-token': 'VbegawtfAM4PzAYcoz2KQLaz7aNfYZkC',
'sec-fetch-dest': 'empty',
accept: '*/*',
origin: 'http://localhost:3000',
'sec-fetch-site': 'same-site',
referer: 'http://localhost:3000/settings',
'accept-encoding': 'gzip, deflate, br',
}
}
}
{
'middleware.rewrite.remote.request': {
rewrite: {
id: 1,
from: '/api/x',
to: 'http://localhost:7000/api/x'
},
method: 'GET',
headers: {
host: 'localhost:7000',
'sec-ch-ua': 'Chromium 78',
'sec-fetch-mode': 'cors',
'authentication-token': 'VbegawtfAM4PzAYcoz2KQLaz7aNfYZkC',
'sec-fetch-dest': 'empty',
accept: '*/*',
origin: 'http://localhost:3000',
'sec-fetch-site': 'same-site',
referer: 'http://localhost:3000/settings',
'accept-encoding': 'gzip, deflate, br',
via: '1.1 lws-rewrite'
}
}
}
{
'middleware.rewrite.remote.response': {
rewrite: {
id: 1,
from: '/api/x',
to: 'http://localhost:7000/api/x'
},
status: 200,
headers: {
connection: 'close',
date: 'Fri, 13 Sep 2019 09:30:23 GMT',
'content-type': 'application/json; charset=utf-8',
'transfer-encoding': 'chunked',
via: '1.1 lws-rewrite'
}
}
}
{
'server.response': {
requestId: 2,
statusCode: 200,
headers: [Object: null prototype] {
date: 'Fri, 13 Sep 2019 09:30:23 GMT',
'content-type': 'application/json; charset=utf-8',
via: '1.1 lws-rewrite'
}
}
}