# Cannot add custom headers to http poll input in logstash

**URL:** <https://discuss.elastic.co/t/cannot-add-custom-headers-to-http-poll-input-in-logstash/48870>\
**Category:** Logstash\
**Created:** [April 30, 2016, 5:34pm UTC](https://discuss.elastic.co/t/cannot-add-custom-headers-to-http-poll-input-in-logstash/48870 "2016-04-30T17:34:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt617](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@matt617](https://discuss.elastic.co/u/matt617)\
**Post date:** [April 30, 2016, 5:34pm UTC](https://discuss.elastic.co/t/cannot-add-custom-headers-to-http-poll-input-in-logstash/48870/1 "2016-04-30T17:34:50Z")

</div>

trying to get data from the uber API to come to stdout (just as an initial test) but cannot seem to get the authorization through the HTTP Header. tried the code below. i think i am close but what am i doing wrong?

```
input {
  http_poller {
    urls => {
      test2 => {
        # Supports all options supported by ruby's Manticore HTTP client
        method => get
     url => "https://api.uber.com/v1/products?latitude=37.7759792&longitude=-122.41823"
        auth => {
        user => ""
        password => "P8YegbF53nWPZST5xX0ZlktVnufXYYQa01Dy0ocm"
        }
      }
    }
    request_timeout => 60
    interval => 60
    codec => "json"
    # A hash of request metadata info (timing, response headers, etc.) will be sent here
    metadata_target => "http_poller_metadata"
  }
}

output {
    stdout {}
}

```

also tried

```
input {
  http_poller {
    urls => {
      test2 => {
        # Supports all options supported by ruby's Manticore HTTP client
        method => get
     url => "https://api.uber.com/v1/products?latitude=37.7759792&longitude=-122.41823"
                headers => {
                Authorization => "P8YegbF53nWPZST5xX0ZlktVnufXYYQa01Dy0ocm"
                }
      }
    }
    request_timeout => 60
    interval => 60
    codec => "json"
    # A hash of request metadata info (timing, response headers, etc.) will be sent here
    metadata_target => "http_poller_metadata"
  }
}

output {
    stdout {}
}
```

---

<div class="post-metadata">

**Author:** ![Nestor\_Manrique](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nestor_manrique/32/70072_2.png) [@Nestor\_Manrique](https://discuss.elastic.co/u/Nestor_Manrique)\
**Post date:** [March 24, 2017, 6:19pm UTC](https://discuss.elastic.co/t/cannot-add-custom-headers-to-http-poll-input-in-logstash/48870/2 "2017-03-24T18:19:05Z")

</div>

I know this post is kind of old but I was facing the same problem until I realized that for some reason I had to wrap the other headers between quotes, although the Accept header don't seem to need them.

This configuration yields syntax errors in /var/log/logstash/logstash-plain.log

```
input{
    http_poller{
        urls => {
            myurl => {
                url => "https://server:port/"
                headers => {
                    Accept => "application/json"
                    Content-Type => "application/json"
                }
            }
...
}

```

This configuration works perfectly. Note the double quotes in Content-type header.

```
input{
    http_poller{
        urls => {
            myurl => {
                url => "https://server:port/"
                headers => {
                    Accept => "application/json"
                    "Content-Type" => "application/json"
                }
            }
...
}

```

Hope this helps other people.

---

<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:** [July 6, 2017, 4:27am UTC](https://discuss.elastic.co/t/cannot-add-custom-headers-to-http-poll-input-in-logstash/48870/3 "2017-07-06T04:27:34Z")

</div>


