File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -238,18 +238,19 @@ class DevServer {
238238 if ( path . endsWith ( ".gz" ) ) {
239239 res . setHeader ( "Content-Encoding" , "gzip" ) ;
240240 }
241- if ( ! res . req . url ) {
242- return ;
243- }
244- const rules : NitroRouteRules = defu (
245- { } ,
246- ...routeRulesMatcher . matchAll ( res . req . url ) . reverse ( )
247- ) ;
248- if ( rules . headers ) {
249- for ( const [ k , v ] of Object . entries ( rules . headers ) ) {
250- if ( k !== "cache-control" )
251- // avoid long caching dev assets
241+ const pathname = ( res . req as any ) ?. _parsedOriginalUrl
242+ ?. pathname as string ;
243+ if ( pathname ) {
244+ const rules : NitroRouteRules = defu (
245+ { } ,
246+ ...routeRulesMatcher . matchAll ( pathname ) . reverse ( )
247+ ) ;
248+ if ( rules . headers ) {
249+ for ( const [ k , v ] of Object . entries ( rules . headers ) ) {
250+ // Avoid long caching dev assets
251+ if ( k === "cache-control" ) continue ;
252252 res . appendHeader ( k , v ) ;
253+ }
253254 }
254255 }
255256 } ,
You can’t perform that action at this time.
0 commit comments