fix: StorySeedling (#1857)
* Story seedling beginning * Font decoding * Bump version number * Remove spam * Remove story seedling ad * Live update nonce * add error for captcha * JSON instead of text compare * Fix proxy crashing on error * Fix captcha error * Fix updatedNonce check * Compression headers should only be forwarded by proxy's that keep the content compressed * Revert index.ts change
This commit is contained in:
@@ -21,13 +21,7 @@ const settings: ServerSetting = {
|
||||
'sec-fetch-dest',
|
||||
'pragma',
|
||||
],
|
||||
disAllowResponseHeaders: [
|
||||
'link',
|
||||
'set-cookie',
|
||||
'set-cookie2',
|
||||
'content-encoding',
|
||||
'content-length',
|
||||
],
|
||||
disAllowResponseHeaders: ['link', 'set-cookie', 'set-cookie2'],
|
||||
useUserAgent: true,
|
||||
};
|
||||
|
||||
@@ -173,7 +167,11 @@ const proxyRequest: Connect.SimpleHandleFunction = (req, res) => {
|
||||
.then(([res2, text]) => {
|
||||
res.statusCode = res2.status;
|
||||
res2.headers.forEach((val, key) => {
|
||||
if (!settings.disAllowResponseHeaders.includes(key)) {
|
||||
if (
|
||||
!settings.disAllowResponseHeaders.includes(key) &&
|
||||
key !== 'content-encoding' &&
|
||||
key !== 'content-length'
|
||||
) {
|
||||
res.setHeader(key, val);
|
||||
}
|
||||
});
|
||||
@@ -186,11 +184,20 @@ const proxyRequest: Connect.SimpleHandleFunction = (req, res) => {
|
||||
res.end();
|
||||
});
|
||||
} else if (settings.fetchMode === FetchMode.PROXY) {
|
||||
proxy.web(req, res, {
|
||||
target: _url.origin,
|
||||
selfHandleResponse: true,
|
||||
followRedirects: true,
|
||||
});
|
||||
proxy.web(
|
||||
req,
|
||||
res,
|
||||
{
|
||||
target: _url.origin,
|
||||
selfHandleResponse: true,
|
||||
followRedirects: true,
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
res.statusCode = 500;
|
||||
res.end();
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user