File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -78,8 +78,9 @@ export async function preview(
7878 }
7979
8080 // proxy
81- if ( config . preview . proxy ) {
82- app . use ( proxyMiddleware ( httpServer , config ) )
81+ const { proxy } = config . preview
82+ if ( proxy ) {
83+ app . use ( proxyMiddleware ( httpServer , proxy , config ) )
8384 }
8485
8586 app . use ( compression ( ) )
Original file line number Diff line number Diff line change @@ -516,7 +516,7 @@ export async function createServer(
516516 // proxy
517517 const { proxy } = serverConfig
518518 if ( proxy ) {
519- middlewares . use ( proxyMiddleware ( httpServer , config ) )
519+ middlewares . use ( proxyMiddleware ( httpServer , proxy , config ) )
520520 }
521521
522522 // base
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { HMR_HEADER } from '../ws'
55import type { Connect } from 'types/connect'
66import type { HttpProxy } from 'types/http-proxy'
77import colors from 'picocolors'
8- import type { ResolvedConfig } from '../..'
8+ import type { CommonServerOptions , ResolvedConfig } from '../..'
99
1010const debug = createDebugger ( 'vite:proxy' )
1111
@@ -30,10 +30,9 @@ export interface ProxyOptions extends HttpProxy.ServerOptions {
3030
3131export function proxyMiddleware (
3232 httpServer : http . Server | null ,
33+ options : NonNullable < CommonServerOptions [ 'proxy' ] > ,
3334 config : ResolvedConfig
3435) : Connect . NextHandleFunction {
35- const options = config . server . proxy !
36-
3736 // lazy require only when proxy is used
3837 const proxies : Record < string , [ HttpProxy . Server , ProxyOptions ] > = { }
3938
You can’t perform that action at this time.
0 commit comments