Skip to content

heymath/nextjs-bug-homepage-i18n-trailingslash-middleware

Repository files navigation

Bug reproduction repository

The bug is the Homepage / is broken when you combine the following:

  • App Router
  • Trailing slash
  • i18n config
  • Middleware

Note

We have this configuration (and more) because in our production app :

  • we have a domain per locale,
  • we need trailing slash because of legacy,
  • we need the middleware to get the locale in App Router because it does not work by default, also dealing with redirections, etc.

Actualy we have Pages Router + App Router because we did not have time to migrate all pages to App Router.

Getting Started

📝 Add dev domains in your /etc/hosts file:

127.0.0.1 www.dev.fr www.dev.es www.dev.it www.dev.de www.dev.ch www.dev.nl

Bug reproduction

  • Go to: http://www.dev.fr
  • See broken homepage (white screen) with logs:
    inject.bundle.js:1 Uncaught Error: Automatic publicPath is not supported in this browser
      at inject.bundle.js:1:12813
      at inject.bundle.js:1:12976
      at inject.bundle.js:1:271814
    (anonymous)	@	inject.bundle.js:1
    (anonymous)	@	inject.bundle.js:1
    (anonymous)	@	inject.bundle.js:1
    

You can test the following cases:

Middleware

(revert any changes)

Trailing slash

(revert any changes)

i18n config

(revert any changes)

About

Bug reproduction repository for broken Homepage when using i18n + trailingslash + middleware

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published