File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
packages/docusaurus/src/commands Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,21 @@ export async function serve(
7676
7777 // We do the redirect ourselves for a good reason
7878 // server-handler is annoying and won't include /baseUrl/ in redirects
79- const normalizedUrl = applyTrailingSlash ( req . url , { trailingSlash, baseUrl} ) ;
80- if ( req . url !== normalizedUrl ) {
81- redirect ( res , normalizedUrl ) ;
82- return ;
79+ // See https://github.com/facebook/docusaurus/issues/10078#issuecomment-2084932934
80+ if ( baseUrl !== '/' ) {
81+ // Not super robust, but should be good enough for our use case
82+ // See https://github.com/facebook/docusaurus/pull/10090
83+ const looksLikeAsset = ! ! req . url . match ( / .[ a - z ] { 1 , 4 } $ / ) ;
84+ if ( ! looksLikeAsset ) {
85+ const normalizedUrl = applyTrailingSlash ( req . url , {
86+ trailingSlash,
87+ baseUrl,
88+ } ) ;
89+ if ( req . url !== normalizedUrl ) {
90+ redirect ( res , normalizedUrl ) ;
91+ return ;
92+ }
93+ }
8394 }
8495
8596 // Remove baseUrl before calling serveHandler, because /baseUrl/ should
You can’t perform that action at this time.
0 commit comments