# Proxying beats outputs

**URL:** https://discuss.elastic.co/t/proxying-beats-outputs/80283
**Category:** Beats
**Created:** [March 28, 2017, 11:03am UTC](https://discuss.elastic.co/t/proxying-beats-outputs/80283 "2017-03-28T11:03:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Mihai-CMM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mihai-cmm/32/125429_2.png) [@Mihai-CMM](https://discuss.elastic.co/u/Mihai-CMM)
#### Post date: [March 28, 2017, 11:03am UTC](https://discuss.elastic.co/t/proxying-beats-outputs/80283/1 "2017-03-28T11:03:55Z")

</div>

Hi community

I want to send elasticsearch.output through an nginx proxy.

If i set that nginx IP i get:  
2017-03-28T10:50:51-04:00 ERR Connecting error publishing events (retrying): Failed to parse JSON response: invalid character '\<' looking for beginning of value

if i set ES host actual IP all works ok.

Idea is to obfuscate ES endpoint from the remote machines where beats are running

Thanks!

---

<div class="post-metadata">

### Author: ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)
#### Post date: [March 29, 2017, 8:35am UTC](https://discuss.elastic.co/t/proxying-beats-outputs/80283/2 "2017-03-29T08:35:36Z")

</div>

Hi @Mihai-CMM,

Can you share your NGINX settings? Also, what's the output in NGINX log?

---

<div class="post-metadata">

### Author: ![Mihai-CMM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mihai-cmm/32/125429_2.png) [@Mihai-CMM](https://discuss.elastic.co/u/Mihai-CMM)
#### Post date: [March 29, 2017, 9:02am UTC](https://discuss.elastic.co/t/proxying-beats-outputs/80283/3 "2017-03-29T09:02:45Z")

</div>

Hi Carlos,  
Actually i think I've just managed to get it work. Not quite what I would like but i think it works like this. I needed to use proxy\_url

1. In metricbeat.yml I've added this lines:

output.elasticsearch:  
# Array of hosts to connect to.  
hosts: ["[browser.shows.this.server.com](http://browser.shows.this.server.com)"]  
index: metricbeat-client1  
proxy\_url: "54.77.26.243/client1" # that's NGINX on AWS

In nginx i have this:

sudo cat /etc/nginx/conf.d/reverseproxy.conf  
server {  
listen 80;  
server\_name [browser.shows.this.server.com](http://browser.shows.this.server.com);  
location / {  
proxy\_set\_header Host https://{my ELK domain} - [west-1.es.amazonaws.com:443](http://west-1.es.amazonaws.com:443);  
proxy\_pass https://{my ELK domain}-west-1.es.amazonaws.com:443;  
}

location /client1 {  
proxy\_set\_header Host https://{my ELK domain} - [west-1.es.amazonaws.com:443](http://west-1.es.amazonaws.com:443);  
proxy\_pass https://{my ELK domain}-west-1.es.amazonaws.com:443;

}

}

Thanks again for looking at this. Will probably follow with other topics on securing this deployment and how to leverage using elastic cloud not AWS elasticsearch

---

<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: [April 18, 2017, 11:04am UTC](https://discuss.elastic.co/t/proxying-beats-outputs/80283/4 "2017-04-18T11:04:13Z")

</div>

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