Marvel behind Nginx

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;
}

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

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

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

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)?

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:

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

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", host: "10.130.37.50"