File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -329,8 +329,17 @@ export function createApp(siteId: string) {
329
329
const blobPrefix = `/${ BUCKET } /fileset/sites/${ manifest . site } /blobs` ;
330
330
let is404Page = req . path === defaults . DEFAULT_404_PAGE ;
331
331
332
+ // Set a cookie indicating that the user wants to disable localization redirects.
333
+ if ( 'ncr' in req . query ) {
334
+ res . cookie ( 'ncr' , 'true' , {
335
+ httpOnly : true ,
336
+ secure : true ,
337
+ } ) ;
338
+ }
339
+
332
340
// If a localized URL path was found, and if `?ncr` is not present, redirect.
333
- if ( localizedUrlPath && req . query . ncr === undefined ) {
341
+ const ncr = 'ncr' in req . query || req . cookies . has ( 'ncr' ) ;
342
+ if ( localizedUrlPath && ! ncr ) {
334
343
if ( localizedUrlPath . endsWith ( '/index.html' ) ) {
335
344
localizedUrlPath = localizedUrlPath . slice ( 0 , - 10 ) ;
336
345
}
You can’t perform that action at this time.
0 commit comments