https://github.com/danielsalles/nuxt-bug-asyncData-Axios
npm install
npm run dev
Open browser:
Acess localhost:3000/usingssr
ctrl+f5

Acess localhost:3000/usingnossr
ctrl+f5

The answer is correct === /usingnossr
Wrong response === /usingssr
This bug is referenced to this question (https://cmty.app/nuxt/nuxt.js/issues/c7224).
I'm basically trying to consume an API and I'm not getting it. If it is HTTP (without SSL) it works normally, but I need SSL enabled.
The server responds with header 'content-encoding': 'br'. Your code works if you clear the 'accept-encoding' header before request:
$axios.setHeader('accept-encoding', false);
Or just 'proxyHeaders: false' in nuxt.config.js:
axios: { proxyHeaders: false }
@zyxd It worked. But is there any special reason to have to do this in SSR mode?
Thanks!
@danielsalles By default, the 'proxyHeaders' mode is enabled. In this mode @nuxt/axios copies all properties of the 'context.request.headers' to axios request headers. Including 'accept-encoding' if your browser send it.
The Chrome browser sends 'accept-encoding: gzip deflate br', because it can decode all of them. But in JS code you must decode it manually or use 'identity' (raw content) encoding which is default if 'accept-encoding' not specified.
Server to which you send requests supports 'identity' and 'br' encoding as i understand.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
The server responds with header 'content-encoding': 'br'. Your code works if you clear the 'accept-encoding' header before request:
Or just 'proxyHeaders: false' in nuxt.config.js: