# 405 error with PUT on /\_searchguard/api/sg\_config

**URL:** <https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873>\
**Category:** Search Guard\
**Created:** [June 25, 2020, 10:31pm UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873 "2020-06-25T22:31:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@brian](https://forum.search-guard.com/u/brian)\
**Post date:** [June 25, 2020, 10:31pm UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873/1 "2020-06-25T22:31:36Z")

</div>

7.7.1-42

I have enabled this setting in elasticsearch.yml  
`searchguard.unsupported.restapi.allow_sgconfig_modification: true`

But when I try to PUT to /\_searchguard/api/sg\_config I get the following error:

```
{
  "error" : "Incorrect HTTP method for uri [/_searchguard/api/sg_config/?pretty=true] and method [PUT], allowed: [PATCH, GET]",
  "status" : 405
}

```

Is there another setting to enable this that I am missing?

---

<div class="post-metadata">

**Author:** ![srgbnd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/srgbnd/32/506_2.png) [@srgbnd](https://forum.search-guard.com/u/srgbnd)\
**Post date:** [June 26, 2020, 8:12am UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873/2 "2020-06-26T08:12:33Z")

</div>

Read the error message again. It says you use the HTTP PUT method. The PUT is not supported. The supported methods are PATCH and GET.

---

<div class="post-metadata">

**Author:** ![brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@brian](https://forum.search-guard.com/u/brian)\
**Post date:** [June 26, 2020, 2:03pm UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873/3 "2020-06-26T14:03:22Z")

</div>

The documentation:

> **[Authentication API](https://docs.search-guard.com/latest/rest-api-authentication)**
>
> How to use the Search Guard REST API to create, modify and change authentication and authorisation settings.

States that PUT / PATCH / GET are all supported. PUT / PATCH are disabled by default, but the config option below should enable both. However…it only enables PATCH and not PUT.

`Since you can break the Search Guard authentication by uploading a faulty configuration, you need to explicitely enable the PUT endpoint by setting searchguard.unsupported.restapi.allow_sgconfig_modification: true in elasticsearch.yml`

---

<div class="post-metadata">

**Author:** ![srgbnd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/srgbnd/32/506_2.png) [@srgbnd](https://forum.search-guard.com/u/srgbnd)\
**Post date:** [June 30, 2020, 10:48am UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873/4 "2020-06-30T10:48:51Z")

</div>

Then it is a bug either in docs or in the API endpoint. Did you try PATCH? Did it work?

---

<div class="post-metadata">

**Author:** ![brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@brian](https://forum.search-guard.com/u/brian)\
**Post date:** [July 7, 2020, 2:45pm UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873/5 "2020-07-07T14:45:22Z")

</div>

PATCH works through the CLI.

---

<div class="post-metadata">

**Author:** ![srgbnd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/srgbnd/32/506_2.png) [@srgbnd](https://forum.search-guard.com/u/srgbnd)\
**Post date:** [July 7, 2020, 4:34pm UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873/6 "2020-07-07T16:34:31Z")

</div>

Thank you for reporting this bug.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/system/32/1870_2.png) [@system](https://forum.search-guard.com/u/system)\
**Post date:** [July 28, 2020, 4:34pm UTC](https://forum.search-guard.com/t/405-error-with-put-on-searchguard-api-sg-config/1873/7 "2020-07-28T16:34:33Z")

</div>

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