USER
USER

Reputation: 781

Add content-encoding header on axios

I use API Gateway on AWS.

First, I activated CORS option and send a request on axios, then it worked.

And I activated content-encoding and I added axios option

axios.defaults.headers.post['Content-Encoding'] = 'gzip'

Then CORS error occured.

How can I solve it?

Upvotes: 3

Views: 14609

Answers (2)

insivika
insivika

Reputation: 624

Should be

     headers: {
        'Accept-Encoding': 'gzip',
      },

Upvotes: 7

Takachi
Takachi

Reputation: 751

Did you add correct headers directly to your axios POST ?

Maybe you could try

axios.post(your-url, {
    headers: {
       'Content-Encoding': 'gzip'
    }
})

Upvotes: 5

Related Questions