APM answer with 404 using nginx proxy_pass

Greetings everyone!
I want to use nginx proxy_pass with APM server.
:green_circle: APM server endpoint works for full url with open port: http://IP:8200/

    {
      "build_date": "2020-07-21T14:00:32Z",
      "build_sha": "f1a08a22e814d19ee01d5d714430a851552d4937",
      "version": "7.8.1"
    }

If I'm using nginx proxy_pass with this config http://mydomain.com/group/apm/:

    server {
        include default_proxy_headers;
        set $upstream_test_apmendpoint http://Test_apm-server:8200;
        resolver 127.0.0.11 ipv6=off valid=10s;
        server_name test.mydomain.com;
        location /group/apm/ {
            proxy_buffering off;
            proxy_pass $upstream_test_apmendpoint;
            add_header Cache-Control "no-cache";
        }
    }

I've got this:

    {
      "error": "404 page not found"
    }

And in the apm server I've got this error.

2020-08-14T07:33:22.788Z	ERROR	[request]	middleware/log_middleware.go:95	404 page not found	{"request_id": "a30bdffe-09db-4f7f-ab65-1b5ddedfcae2", "method": "GET", "URL": "/seller/apm/", "content_length": 0, "remote_address": "83.242.98.64", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0", "response_code": 404, "error": "404 page not found"}

APM Server version: apm-server; Version: 7.8.1
APM Server Config:

    apm-server: 
      host: "0.0.0.0:8200"
      rum: 
        allow_headers: []
        allow_origins: 
          - "*"
        enabled: true
        event_rate: 
          limit: 300
          lru_size: 1000
    output.elasticsearch: 
      hosts: 
        - "elasticsearch:9200"
      password: "secret"
      username: elastic

The problem was in trailing slash in nginx config. The right part is

    location /group/apm/ {
        proxy_buffering off;
        proxy_pass http://Test_apm-server:8200/;
        add_header Cache-Control "no-cache";
    }

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