Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: incorrect header check at Zlib._handle.onerror when POST in axios #435

Closed
iroy2000 opened this issue Sep 3, 2016 · 1 comment
Closed

Comments

@iroy2000
Copy link

iroy2000 commented Sep 3, 2016

I setup my own node express application, and when I'm trying to do POST, I got an error when I do a POST from client side

// client side code
axios.post(MY_TEST_URL, data)
    .then(response => {
      console.log(response);
      return response.data
    })

And I got this error from my node express server

{ Error: incorrect header check
    at Zlib._handle.onerror (zlib.js:370:17) errno: -3, code: 'Z_DATA_ERROR', status: 400, statusCode:
 400 } 'Error: incorrect header check\n    at Zlib._handle.onerror (zlib.js:370:17)'

And the following is the header I received in the error handling from my express error handling

{ host: 'localhost:9898',
  connection: 'keep-alive',
  'content-length': '13',
  accept: 'application/json, text/plain, */*',
  origin: 'http://localhost:8080',
  'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36',
  'content-type': 'application/json;charset=UTF-8',
  referer: 'http://localhost:8080/',
  'accept-encoding': 'gzip, deflate',
  'accept-language': 'en-US,en;q=0.8',
  'content-encoding': 'gzip' } 

The following is my "Network Tab"

( This one is Preflight Check )
screen shot 2016-09-02 at 8 48 32 pm

screen shot 2016-09-02 at 8 48 52 pm

And this is the curl generate from chrome devtool when I observe my frontend application

curl 'http://localhost:9898/api/test' -H 'Content-Encoding: gzip' -H 'Origin: http://localhost:8080' -H
 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36' -H 'Content-Type: 
application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Referer: 
http://localhost:8080/' -H 'Connection: keep-alive' --data '{"email":"[email protected]"}' --compressed

It is totally fine when I do that from POSTMAN.

Any help will be appreciated, thanks.

@rubennorte
Copy link
Member

Compression is done automatically in the browser, so it must be something unrelated to axios. Please test it with a newer version of your browser or maybe check if there's a bug in Node or Express about this.

@axios axios locked and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants