2

I'm using next.config in order to redirect non www requests.

redirects: async () => [
 {
  source: '/:path*',
  has: [{ type: 'host', value: 'example.com' }],
  destination: 'https://www.example.com'/:path*',
  permanent: true,
 },  
]

Now as you can see permanent property set to true which returns status code 308. Is there any way to change the status code to - 301?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38

2 Answers2

0

Change permanent value to false

user3778845
  • 89
  • 1
  • 4
0

308 (moved) and 307 (temporarily moved) are the more precise status codes. most browsers understand 307/308 in the meantime. Only Internet Explorer-Legacy has some issues with it.

The issue was, that with a 301, the browser switched to a GET-request while with a 308 the browser keeps the original request-type (such as PUT/POST/etc).

https://serverfault.com/a/897923

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308

Ernst Zwingli
  • 1,402
  • 1
  • 8
  • 24