Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A 502 Bad Gateway means the gateway (often Nginx, a load balancer, or an ingress controller) could not obtain a valid response from its upstream service. After a new ELK installation, test Kibana and Elasticsearch directly before changing the proxy. The usual causes are Kibana still starting, an unreachable Elasticsearch URL, mixed stack versions, an incorrect upstream port or scheme, TLS trust failures, path/basePath mistakes, or proxy timeouts.

What the 502 is actually telling you

The browser is reporting a failure at the gateway layer, not necessarily a failure in every ELK component. A reverse proxy accepts the browser request and then opens a second connection to an upstream service. It returns 502 when that second hop is refused, closed unexpectedly, addressed incorrectly, or produces a response the proxy cannot use. A timeout may instead appear as 504, but the exact status depends on the gateway.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In a typical browser-to-Kibana deployment, the path is:

  1. Browser requests the public URL.
  2. Nginx or another gateway receives the request.
  3. The gateway connects to Kibana, normally on HTTP port 5601 unless you changed it.
  4. Kibana connects to Elasticsearch, normally on HTTP port 9200.

A 502 can therefore come from the browser-to-Kibana hop or from a request that Kibana makes to Elasticsearch. Discover and search pages can expose the second type even when the Kibana home page loads.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Identify which upstream failed before changing anything

Use the direct-service result and the timing of the failure to classify the problem. Do not assume that every 502 is a Kibana process failure.

What you observe Most likely hop First check
The public URL returns 502, but a direct request to port 5601 works Gateway-to-Kibana configuration Upstream host, port, scheme, headers, path, and certificate verification
Both the public URL and direct port 5601 fail during startup Kibana process or readiness Kibana status API and startup logs
Kibana loads, but Discover or searches fail Kibana-to-Elasticsearch or a separate Elasticsearch proxy path Elasticsearch URL, authentication, TLS trust, and proxy logs
Failure began immediately after changing packages or plugins Delayed startup or migration Kibana logs and readiness state
Only HTTPS through the gateway fails TLS or HTTP/HTTPS mismatch Proxy scheme, upstream certificate, and trust settings

Record whether the error is immediate or appears after a fixed delay. An immediate refusal usually indicates a wrong address, stopped service, or blocked port. A repeatable delay points more strongly to a connect or read timeout, a slow startup, or an Elasticsearch request that never completes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Check Kibana directly with its status API

Run these commands on the Kibana host, or from a machine that can reach the configured Kibana listener:

curl -i http://127.0.0.1:5601/status
curl -sS http://127.0.0.1:5601/api/status

Kibana documents /status as a human-readable status endpoint and /api/status as the JSON endpoint. The JSON response lets you inspect overall status and the health of core plugins. Replace 127.0.0.1 with the actual bind address when Kibana is listening elsewhere, and use HTTPS if you configured Kibana itself for TLS.

Interpret the result

  • Connection refused: Kibana is stopped, listening on another address or port, or blocked locally. Check the service state and its configured server port.
  • Connection times out: The listener may be on a different interface, a firewall may be blocking it, or you are testing the wrong host.
  • HTTP response with an unavailable or degraded state: Kibana is running but may not be ready. Continue with the logs and Elasticsearch checks rather than pointing the gateway at it repeatedly.
  • Healthy direct response: Focus on the reverse proxy. A healthy response on port 5601 rules out many Kibana process problems.

When the gateway runs on a different machine, repeat the test from that machine using the exact hostname and port in the proxy configuration. A successful localhost test proves only local reachability; it does not prove that Nginx can reach the same address.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

2. Read Kibana startup and readiness logs

Inspect the logs covering the first failed request and the preceding startup period. Look for Elasticsearch connection errors, failed migrations, authentication failures, certificate errors, address-binding messages, and plugin initialization problems. Elastic’s Kibana troubleshooting material specifically covers server logs, readiness errors, Elasticsearch query tracing, monitoring, migrations, alerts, and diagnostics.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a systemd installation, a typical command is:

sudo journalctl -u kibana --since "30 minutes ago" --no-pager

For a container deployment, use the runtime’s log command and include the container’s startup output. Do not discard early lines just because the process eventually stays running.

Allow for legitimate delayed readiness

A newly installed or reconfigured Kibana can take longer to become ready. Plugin changes and browser-resource re-optimization can extend startup, so a gateway may return errors temporarily while Kibana completes initialization. The status API and logs are the authority: wait only while they show forward progress. A process that remains unavailable with repeated identical errors is not made healthy by increasing the proxy timeout.

Check the configured listener

Confirm Kibana’s server host, server port, and protocol settings match the address used by the gateway. The default HTTP port is 5601, but local configuration can override it. A common mistake is binding Kibana only to loopback while the gateway runs in another container or host; in that arrangement, localhost inside the gateway refers to the gateway itself, not the Kibana machine.

3. Test Elasticsearch from the Kibana host

Kibana must reach the Elasticsearch URL configured for it. Test that exact URL from the same network namespace where Kibana runs, including credentials and the TLS options used in production.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
curl -i http://elasticsearch-host:9200/
curl -k -i https://elasticsearch-host:9200/

Use -k only as a diagnostic when certificate verification is the suspected issue; do not leave verification disabled as the fix. If authentication is enabled, supply the appropriate credentials through a protected method rather than placing secrets in shell history.

  • HTTP 200 or a normal Elasticsearch response: Basic network reachability works. Verify that Kibana uses the same scheme, hostname, credentials, and trust chain.
  • DNS failure: Correct the hostname or container/service discovery configuration.
  • Connection refused: Elasticsearch may be stopped, listening on another interface, or using a different port.
  • TLS handshake or certificate error: Install the correct CA or configure the documented trust settings; do not simply switch the proxy to HTTP unless the whole path is intentionally non-TLS.
  • 401 or 403: The service is reachable, but Kibana’s credentials or privileges are wrong.

Elasticsearch’s documented default HTTP port is 9200. Port 9300 is the transport port used for node-to-node communication; it is not the port to place in a browser or Kibana HTTP URL. Firewalls and security groups must permit the actual configured path.

4. Make every Elastic Stack component use the same release

Elastic’s deployment guidance states that the entire stack must use the same version. Check Elasticsearch, Kibana, Logstash, Beats, and APM components rather than checking only the two services visible in the browser.

Component What to verify Why it matters
Elasticsearch Installed and running release Provides the API and data services Kibana expects
Kibana Installed and running release Must match Elasticsearch for supported migrations and APIs
Logstash Installed release and output plugins Mixed packages can create pipeline and plugin incompatibilities
Beats and APM Agent/server release These are also part of the stack-version requirement

Correct mixed packages before tuning Nginx. A proxy can faithfully forward requests while an incompatible Kibana/Elasticsearch pair fails behind it, producing symptoms that look like a gateway problem.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Audit the reverse-proxy upstream

Once direct Kibana access is healthy, inspect the gateway configuration line by line. Verify all of the following:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
  • Upstream hostname and port: They must resolve from the gateway’s own host or container. Use the actual Kibana port, not Elasticsearch’s 9200 or transport port 9300.
  • Protocol: An http:// upstream pointed at an HTTPS listener, or an https:// upstream pointed at plain HTTP, commonly produces connection or TLS errors.
  • Certificate verification: For HTTPS upstreams, the gateway needs a trusted CA and a hostname that matches the certificate, unless your security policy explicitly uses another verification arrangement.
  • Forwarding headers: Preserve the original host and useful client/protocol information with the gateway’s standard Host and X-Forwarded-* headers.
  • Path handling: A proxy that publishes Kibana under /kibana must agree with Kibana’s server.basePath and public-base-path behavior. Incorrect slash rewriting can send valid requests to nonexistent paths.
  • Connect and read timeouts: They must accommodate normal startup and query latency, but raising them cannot repair a refused connection or a bad certificate.

A minimal root-path pattern for a plain-HTTP Kibana listener looks like this conceptually:

location / {
    proxy_pass http://127.0.0.1:5601;
    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_set_header X-Forwarded-Proto $scheme;
}

Treat this as a pattern, not a drop-in configuration. Change the address, protocol, and path to match your deployment, then validate the gateway configuration and reload it using your platform’s normal procedure. If Kibana is under a subpath, configure both sides deliberately; do not combine a subpath location with a root-path Kibana configuration by trial and error.

Use proxy logs to name the failed hop

Read the gateway’s error log at the same time as the request. Messages such as connection refused, no route to host, upstream timed out, or SSL certificate verification failure distinguish network, timeout, and TLS causes. If the log identifies an Elasticsearch upstream rather than Kibana, follow the separate Elasticsearch path instead of changing the Kibana location block.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Handle 502 responses that occur only in Discover or searches

If the Kibana landing page and status API work but Discover fails, the browser request may trigger an Elasticsearch call that uses a different proxy route or fails between Kibana and Elasticsearch. Check:

  1. The Elasticsearch URL configured in Kibana.
  2. Authentication and privileges for the Kibana service account.
  3. CA certificates and hostname validation.
  4. Any gateway or ingress rule that separately proxies Elasticsearch APIs.
  5. Gateway and Kibana logs for the exact request path and upstream address.

An Elastic community troubleshooting response recommends checking proxy logs when Elasticsearch is the server handling the failed request. That distinction matters: changing the browser-facing Kibana upstream will not fix a failed Elasticsearch hop.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

7. Review Logstash HTTP output only when the pipeline is involved

Logstash has its own HTTP output behavior and can generate delivery errors that are unrelated to a browser’s Kibana 502. The official HTTP output plugin reference lists 429, 500, 502, 503, and 504 as retryable responses when retry_failed is enabled. It also documents proxy, socket-timeout, and TLS settings.

Inspect the Logstash pipeline when events are failing to reach an HTTP destination, not as proof that Kibana caused the gateway error. Verify the destination URL, proxy settings, socket timeout, TLS trust, and retry policy. A retrying pipeline can conceal the original response in logs, so capture the first failure and its upstream address.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common failure patterns and precise fixes

Symptom Likely cause Action
curl to 5601 is refused Kibana stopped, wrong port, or wrong bind address Read Kibana startup logs, verify listener settings, and restart only after correcting the cause
Direct 5601 works; public URL is 502 Bad Nginx upstream, container DNS, scheme, or firewall rule Test the upstream from the gateway host and read its error log
Direct Kibana status is degraded Elasticsearch unreachable, unauthorized, or untrusted TLS Run the Elasticsearch test from the Kibana host and fix the reported class of error
Failure follows package upgrades Version mismatch or migration/startup delay Align all stack versions and wait for verified readiness
Only HTTPS proxying fails Upstream certificate or scheme mismatch Validate the certificate chain and use the correct upstream protocol
Only a subpath URL fails Proxy rewrite and Kibana base-path disagreement Make the published path and Kibana base-path settings consistent
Discover alone returns 502 Elasticsearch-facing route or query failure Inspect Elasticsearch and proxy logs for that request

Safe diagnostic sharing

Logs and diagnostic bundles can contain product metadata, hostnames, settings, tokens, and other sensitive values. Before posting output, remove credentials, API keys, cookies, authorization headers, private hostnames, internal IP addresses, and certificate material. Preserve timestamps, HTTP status codes, upstream addresses in anonymized form, and the exact error wording; those details are what identify the failed hop.

A short recovery sequence

  1. Request /api/status directly from the Kibana host.
  2. Read Kibana logs until startup, migration, and Elasticsearch connection errors are explained.
  3. From that host, request the configured Elasticsearch URL on port 9200 or its intentional alternative.
  4. Verify credentials, TLS trust, firewall rules, and DNS for both services.
  5. Confirm every Elastic Stack component uses one release version.
  6. Test the exact Kibana upstream from the gateway machine or container.
  7. Correct HTTP/HTTPS, certificate, forwarding-header, path/basePath, and timeout settings.
  8. Retest the public URL, then test a Discover query separately.

This order prevents a healthy gateway from masking a non-ready Kibana and prevents proxy edits from hiding a deeper Elasticsearch or version problem.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.