# Kibana8.4.3 & nginx，nginx returns 502 bad gateway

**URL:** <https://discuss.elastic.co/t/kibana8-4-3-nginx-nginx-returns-502-bad-gateway/350197>\
**Category:** Kibana\
**Created:** [January 2, 2024, 7:29am UTC](https://discuss.elastic.co/t/kibana8-4-3-nginx-nginx-returns-502-bad-gateway/350197 "2024-01-02T07:29:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaygayGuys](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gaygayguys/32/130454_2.png) [@gaygayGuys](https://discuss.elastic.co/u/gaygayGuys)\
**Post date:** [January 2, 2024, 7:29am UTC](https://discuss.elastic.co/t/kibana8-4-3-nginx-nginx-returns-502-bad-gateway/350197/1 "2024-01-02T07:29:19Z")

</div>

hello everyone ! i need help !!!!  
when i use nginx to proxy kibana ,i find a tricky problem.  
at the beginning ,everything is ok. but several minutes later, 502 bad gateway is starting to appear! i hava no idea to solve the problem!

my kibana is running in a docker container

## hear is my nginx config:

```auto
location /kibana/ {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_redirect off;
            proxy_pass http://192.168.197.36:5601;
}

```

* * *

## and here is my kibana.yml

```auto
server.host: "0.0.0.0"
server.shutdownTimeout: "5s"
monitoring.ui.container.elasticsearch.enabled: true
i18n.locale: "zh-CN"

elasticsearch.hosts: ['https://172.18.0.2:9200']
elasticsearch.serviceAccountToken: AAEAAWVsYXN0aWMva2liYW5hL2Vucm9sbC1wcm9jZXNzLXRva2VuLTE3MDM2OTU1MTY4MjM6dzlscHBzMGtRY2U1cmdRM2Y2VXFGZw
elasticsearch.ssl.certificateAuthorities: [/usr/share/kibana/data/ca_1703695517724.crt]
xpack.fleet.outputs: [{id: fleet-default-output, name: default, is_default: true, is_default_monitoring: true, type: elasticsearch, hosts: ['https://172.18.0.2:9200'], ca_trusted_fingerprint: a4eda4584e65805baae3f907bf9760f980496eb299273ce139892b1b0721e987}]

server.basePath: "/kibana"
server.rewriteBasePath: true

```

* * *

so , when i use these config, at the beginning , no errors, after two or three minites, 502 ! 502! 502! why ???

and i also found , i did nothing ,but maybe ten minutes later ,everything is ok, 502 disappear,why ???

## by the way , here is the kibana's error info when 502 bad gateway:

```auto
Error: Batch request failed with status 502
    at search_interceptor_SearchInterceptor.handleSearchError (https://myurl/kibana/55572/bundles/plugin/data/kibana/data.plugin.js:1:410387)
    at https://myurl/kibana/55572/bundles/plugin/data/kibana/data.plugin.js:1:413128
    at https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:364:106267
    at s._error (https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:29524)
    at t.error (https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:88987)
    at https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:329:46099
    at o (https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:252982)
    at t.error (https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:329:45966)
    at Object.error (https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:430606)
    at e.error (https://myurl/kibana/55572/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:89793)

```

---

<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:** [January 30, 2024, 7:30am UTC](https://discuss.elastic.co/t/kibana8-4-3-nginx-nginx-returns-502-bad-gateway/350197/2 "2024-01-30T07:30:14Z")

</div>

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