removes origin/referer headers from proxied request
This commit is contained in:
parent
db034a51b3
commit
602931bf7f
|
@ -14,6 +14,7 @@ import {
|
|||
finalizeBody,
|
||||
languageFilter,
|
||||
limitOutputTokens,
|
||||
removeOrigin,
|
||||
} from "./middleware/request";
|
||||
import {
|
||||
ProxyResHandlerWithBody,
|
||||
|
@ -75,6 +76,7 @@ const rewriteAnthropicRequest = (
|
|||
blockZoomers,
|
||||
languageFilter,
|
||||
limitOutputTokens,
|
||||
removeOrigin,
|
||||
finalizeBody,
|
||||
];
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ export { finalizeBody } from "./finalize-body";
|
|||
export { languageFilter } from "./language-filter";
|
||||
export { limitCompletions } from "./limit-completions";
|
||||
export { limitOutputTokens } from "./limit-output-tokens";
|
||||
export { removeOrigin } from "./remove-origin";
|
||||
export { transformKoboldPayload } from "./transform-kobold-payload";
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { ProxyRequestMiddleware } from ".";
|
||||
|
||||
/**
|
||||
* Removes origin and referer headers before sending the request to the API for
|
||||
* privacy reasons.
|
||||
**/
|
||||
export const removeOrigin: ProxyRequestMiddleware = (proxyReq) => {
|
||||
proxyReq.setHeader("origin", "");
|
||||
proxyReq.setHeader("referer", "");
|
||||
};
|
|
@ -15,6 +15,7 @@ import {
|
|||
languageFilter,
|
||||
limitCompletions,
|
||||
limitOutputTokens,
|
||||
removeOrigin,
|
||||
} from "./middleware/request";
|
||||
import {
|
||||
createOnProxyResHandler,
|
||||
|
@ -95,6 +96,7 @@ const rewriteRequest = (
|
|||
languageFilter,
|
||||
limitOutputTokens,
|
||||
limitCompletions,
|
||||
removeOrigin,
|
||||
finalizeBody,
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue