# Marvel behind Nginx

**URL:** <https://discuss.elastic.co/t/marvel-behind-nginx/59246>\
**Category:** Kibana\
**Tags:** elastic-stack-monitoring\
**Created:** [August 29, 2016, 10:19pm UTC](https://discuss.elastic.co/t/marvel-behind-nginx/59246 "2016-08-29T22:19:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saurabh\_Jambhule](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Saurabh\_Jambhule](https://discuss.elastic.co/u/Saurabh_Jambhule)\
**Post date:** [August 29, 2016, 10:19pm UTC](https://discuss.elastic.co/t/marvel-behind-nginx/59246/1 "2016-08-29T22:19:09Z")

</div>

Hello, I am getting following error when try to access Marvel through Nginx proxy pass:  
Marvel: Error 404 Not Found: undefined

Well I am using latest versions of all.

My Nginx configuration is as follow:

```
    location /kibana {
	proxy_pass http://127.0.0.1:5601/app/kibana;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header Host $host;
}

location /bundles {
	proxy_pass http://127.0.0.1:5601/bundles;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header Host $host;
}

location /elasticsearch {
	proxy_pass http://127.0.0.1:5601/elasticsearch;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header Host $host;
}

location /plugins {
	proxy_pass http://127.0.0.1:5601/plugins;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header Host $host;
}

location /app/ {
	proxy_pass http://127.0.0.1:5601/app/;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header Host $host;
}

location /marvel {
    proxy_pass http://127.0.0.1:5601/timelion;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
}

location /_nodes {
	proxy_http_version 1.1;
	proxy_ignore_headers Cache-Control;
	proxy_pass http://localhost:9200/_nodes;
	proxy_read_timeout 90;
	proxy_redirect off;
	proxy_set_header Host $http_host;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
}

location /timelion {
    proxy_pass http://127.0.0.1:5601/timelion;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
}
```

---

<div class="post-metadata">

**Author:** ![pickypg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pickypg/32/62409_2.png) [@pickypg](https://discuss.elastic.co/u/pickypg)\
**Post date:** [August 29, 2016, 10:59pm UTC](https://discuss.elastic.co/t/marvel-behind-nginx/59246/2 "2016-08-29T22:59:32Z")

</div>

The first issue is that `/marvel` is attempting to be redirected to `/timelion`:

```auto
location /marvel {
    proxy_pass http://127.0.0.1:5601/timelion;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
}

```

Hope that helps,  
Chris

---

<div class="post-metadata">

**Author:** ![Saurabh\_Jambhule](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Saurabh\_Jambhule](https://discuss.elastic.co/u/Saurabh_Jambhule)\
**Post date:** [August 30, 2016, 7:01am UTC](https://discuss.elastic.co/t/marvel-behind-nginx/59246/3 "2016-08-30T07:01:46Z")

</div>

Sorry my bad, I post it mistakenly.  
Its not working, getting same error.

---

<div class="post-metadata">

**Author:** ![pickypg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pickypg/32/62409_2.png) [@pickypg](https://discuss.elastic.co/u/pickypg)\
**Post date:** [August 30, 2016, 3:20pm UTC](https://discuss.elastic.co/t/marvel-behind-nginx/59246/4 "2016-08-30T15:20:45Z")

</div>

The issue is most likely that you're not proxying enough of the requests. Why not simplify your proxy and add a `base_path` to Kibana so that all of Kibana is accessible via simple URL to your proxy (e.g., `/kibana`)?

```auto
location /kibana {
	proxy_pass http://127.0.0.1:5601;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header Host $host;
}

```

Then, from Kibana's `config/kibana.yml`, you can add the proxy base path setting:

```auto
server.basePath: /kibana

```

Using both will prepend and require `/kibana` for access to Kibana, but it means that it can be tunneled through your proxy without issue, while still allowing you to route other requests. There are a lot of background APIs that both Marvel and Kibana will call that don't go through the endpoints that you have routed above. As a result, you are going to have to constantly play wackamole to keep up with any changes in order for your existing approach to proxying to work.

Personally, I don't think it's a good idea to join Elasticsearch and Kibana within the same proxy: it's absolutely going to make your proxy more difficult to configure and realistic deployments of Kibana and Elasticsearch should not be on the same box.

Hope that helps,  
Chris

---

<div class="post-metadata">

**Author:** ![Saurabh\_Jambhule](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Saurabh\_Jambhule](https://discuss.elastic.co/u/Saurabh_Jambhule)\
**Post date:** [August 30, 2016, 3:58pm UTC](https://discuss.elastic.co/t/marvel-behind-nginx/59246/5 "2016-08-30T15:58:20Z")

</div>

I tried what you said, but now I am getting 502 gateway error.  
And not able to access anything.

This is my Nginx log:  
2016/08/30 21:14:06 [error] 17403#17403: \*461 connect() failed (111: Connection refused) while connecting to upstream, client: 10.130.37.50, server: 10.130.37.50, request: "GET /kibana HTTP/1.1", upstream: "[http://127.0.0.1:5601/kibana](http://127.0.0.1:5601/kibana)", host: "10.130.37.50"

---

<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, 1:42pm UTC](https://discuss.elastic.co/t/marvel-behind-nginx/59246/6 "2017-07-06T13:42:11Z")

</div>


