# AuthorizationException in Authorization header

**URL:** <https://discuss.elastic.co/t/authorizationexception-in-authorization-header/231407>\
**Category:** Elasticsearch\
**Created:** [May 6, 2020, 8:50pm UTC](https://discuss.elastic.co/t/authorizationexception-in-authorization-header/231407 "2020-05-06T20:50:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ketan\_Chachad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ketan_chachad/32/49908_2.png) [@Ketan\_Chachad](https://discuss.elastic.co/u/Ketan_Chachad)\
**Post date:** [May 6, 2020, 8:50pm UTC](https://discuss.elastic.co/t/authorizationexception-in-authorization-header/231407/1 "2020-05-06T20:50:12Z")

</div>

Hi,  
I have a python service API that connects to an ES instance to query an index and return the query result.  
I was previously using ES on the same local machine and everything was working great.  
Due to disk space and memory issues I had to move the ES instance to AWS ES.  
Now when I call my service API, I am getting the following error:

```auto
elasticsearch.exceptions.AuthorizationException: AuthorizationException(403, '{"message":"\'ABcde#FgHijklMNopQrs\' not a valid key=value pair (missing equal-sign) in Authorization header: \'Basic ABcde#FgHijklMNopQrs\'."}')

```

The request that is causing this error is as follows:  
`curl -XPOST https://<aws-es-instance>:443/my_index/_search`

Any solutions for this error?

---

<div class="post-metadata">

**Author:** ![Ketan\_Chachad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ketan_chachad/32/49908_2.png) [@Ketan\_Chachad](https://discuss.elastic.co/u/Ketan_Chachad)\
**Post date:** [May 7, 2020, 3:25pm UTC](https://discuss.elastic.co/t/authorizationexception-in-authorization-header/231407/2 "2020-05-07T15:25:54Z")

</div>

Hi,  
Continuing to the above, I have found out that the AWS ES URL does not need the port 443 to be provided to Authenticate the request.  
Is there a way to instruct Elasticsearch config to not use the port when sending the authentication request?

---

<div class="post-metadata">

**Author:** ![Ketan\_Chachad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ketan_chachad/32/49908_2.png) [@Ketan\_Chachad](https://discuss.elastic.co/u/Ketan_Chachad)\
**Post date:** [May 7, 2020, 8:39pm UTC](https://discuss.elastic.co/t/authorizationexception-in-authorization-header/231407/3 "2020-05-07T20:39:55Z")

</div>

Here is another update to the above.  
I read about this exception in  
[https://github.com/sivasamyk/logtrail/issues/323](https://discuss.elastic.co/t/authorizationexception-in-authorization-header/231407)  
There the user has mentioned that the exception was avoided by removing the Authorization header.  
Can anyone tell me how I can remove this header when connecting to ES?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 4, 2020, 8:39pm UTC](https://discuss.elastic.co/t/authorizationexception-in-authorization-header/231407/4 "2020-06-04T20:39:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
