Skip to content

What is the best place to redirect based on the user-agent while using ISR? #21413

Answered by pke
michaelschufi asked this question in Help
Discussion options

You must be logged in to vote

This nextjs blog post covers your IE11 case pretty much :)
https://nextjs.org/blog/next-10-2#routing-based-on-headers-and-query-string-parameters

module.exports = {
  async redirects() {
    return [
      {
        source: '/:path((?!old-browser$).*)',
        has: [
          {
            type: 'header',
            key: 'User-Agent',
            value:
              'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; Microsoft; Lumia 950)'
          }
        ],
        destination: '/old-browser',
        permanent: false
      }
    ]
  }
}

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@michaelschufi
Comment options

@rishi-raj-jain
Comment options

@pke
Comment options

@rishi-raj-jain
Comment options

Answer selected by michaelschufi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants