+4
-4
@@ -1,5 +1,5 @@
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import type { ClientRequest, IncomingMessage as ProxyIncomingMessage } from "node:http";
|
||||
import type { IncomingMessage as ProxyIncomingMessage } from "node:http";
|
||||
import type { ProxyOptions } from "vite";
|
||||
import { MENU_SITE_ORIGIN, isMenuSlugProxyPath, stripMenuPreviewCacheParam, toMenuSitePath } from "./src/config/menuPreview";
|
||||
|
||||
@@ -65,9 +65,9 @@ export const getMenuSiteTargetUrl = (url: string) => {
|
||||
return `${MENU_SITE_ORIGIN}${menuPath}${stripMenuPreviewCacheParam(search)}`;
|
||||
};
|
||||
|
||||
export const createMenuSlugProxyAgent = () => ({
|
||||
configure: (proxy: { on: (event: string, handler: (...args: unknown[]) => void) => void }) => {
|
||||
proxy.on("proxyReq", (proxyReq: ClientRequest) => {
|
||||
export const createMenuSlugProxyAgent = (): { configure: NonNullable<ProxyOptions["configure"]> } => ({
|
||||
configure: (proxy) => {
|
||||
proxy.on("proxyReq", (proxyReq) => {
|
||||
proxyReq.removeHeader("origin");
|
||||
});
|
||||
proxy.on("proxyRes", stripPreviewPageHeaders);
|
||||
|
||||
Reference in New Issue
Block a user