Failed to load resource: the server responded with a status of 502 (Bad Gateway)

root@felipe-udeabase:~# sudo systemctl status metabase
● metabase.service - Metabase server
	 Loaded: loaded (/etc/systemd/system/metabase.service; enabled; vendor preset: enabled)
	 Active: active (running) since Tue 2022-06-07 21:40:58 UTC; 6min ago
   Main PID: 21095 (java)
	  Tasks: 62 (limit: 9406)
	 Memory: 801.1M
	 CGroup: /system.slice/metabase.service
			 └─21095 /usr/bin/java -jar /var/metabase.jar

Jun 07 21:41:12 metabase[21095]: 2022-06-07 21:41:12,225 INFO core.QuartzScheduler :: Scheduler MetabaseSchedule>
Jun 07 21:41:12 metabase[21095]: 2022-06-07 21:41:12,227 INFO metabase.task :: Task scheduler started
Jun 07 21:41:12 metabase[21095]: 2022-06-07 21:41:12,228 INFO metabase.core :: Metabase Initialization COMPLETE
Jun 07 21:41:12 metabase[21095]: 2022-06-07 21:41:12,265 INFO task.refresh-slack-channel-user-cache :: Slack is >
Jun 07 21:41:25 metabase[21095]: 2022-06-07 21:41:25,688 INFO middleware.misc :: Setting Metabase site URL to 19>
Jun 07 21:41:26 metabase[21095]: 2022-06-07 21:41:26,101 INFO i18n.impl :: Reading available locales from locale>
Jun 07 21:41:26 metabase[21095]: 2022-06-07 21:41:26,193 INFO util.fonts :: Reading available fonts from /fronte>
Jun 07 21:41:27 metabase[21095]: 2022-06-07 21:41:27,084 WARN protocol.ResponseProcessCookies :: Invalid cookie >
Jun 07 21:41:27 metabase[21095]: 2022-06-07 21:41:27,837 DEBUG middleware.log :: GET /api/session/properties 200>
Jun 07 21:45:47 metabase[21095]: 2022-06-07 21:45:47,658 DEBUG middleware.log :: GET /api/session/properties 200>


nano /etc/systemd/system/metabase.service

	Description=Metabase server[Service]

	ExecStart=/usr/bin/java -jar /var/metabase.jar
	#ExecStart=/usr/bin/java -DMB_JETTY_PORT=3100 -jar /apps/java/metabase.jar


how solve this?

root@felipe-udeabase:~# sudo nginx -t
nginx: [warn] conflicting server name "" on, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Hi @mgtrfelipeurrego, this seems to be an issue with Nginx, maybe a bad configuration. So please post your Nginx conf. Or completely delete nginx and run only Metabase (but know the limitations of doing this)

cd /etc/nginx/sites-available

and edit with this

nano ngnix.conf

#add these lines
server {
return 301; }
#(for nano ctrl-o then ctrl-m and then ctrl-x it will save and exit the file)

cd /etc/nginx/sites-enabled/

#add this line
 listen 443 ssl;
 location /
 proxy_set_header Host $http_host;
 proxy_set_header X-Forwarded-Host $host;
 proxy_set_header X-Forwarded-Server $host;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Graylog-Server-URL;
 # proxy_pass;
 #ssl on;
 ssl_certificate /root/.local/share/mkcert/;
 ssl_certificate_key /root/.local/share/mkcert/;
 ssl_session_timeout 5m;
 ssl_protocols TLSv1.2;
 ssl_prefer_server_ciphers on;
 access_log /var/log/nginx/;
 error_log /var/log/nginx/;

# http to https redirection
server {
	listen 80;
	add_header Strict-Transport-Security max-age=2592000;
	rewrite ^ https://$server_name$request_uri? permanent;

and this one

nano /etc/nginx/sites-available/metabase


server {
		listen 443;
		ssl_certificate /root/.local/share/mkcert/;
		ssl_certificate_key /root/.local/share/mkcert/;
		#ssl on;
		access_log /var/log/nginx/metabase.access.log;
		location / {
				proxy_set_header host $host;
				proxy_http_version 1.1;
				proxy_set_header upgrade $http_upgrade;
				proxy_set_header connection "upgrade";


next this

ln -s /etc/nginx/sites-available/metabase /etc/nginx/sites-enabled/metabase

nginx -t

nginx: [warn] conflicting server name "" on, ignored
nginx: [warn] conflicting server name "" on, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Please use a simple Nginx config like

server {
    listen 80;
    listen [::]:80;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_header Server;
    proxy_connect_timeout 3s; 
    proxy_read_timeout 10s;
    # server_name;
    # if ($scheme != "https") {
    #     return 301 https://$host$request_uri;
    # }
    # }

    location / {
        proxy_pass http://localhost:3000;

Once you have nginx and metabase working together then start adding https/certs, etc. The config you sent above has a lot of conflicts (many servers have the same name)

still failing, pls view this video with all my enviroment

Hi @mgtrfelipeurrego, so you're running the Metabase instance locally in your network? ( if that's the case, unless you override the DNS entry of "" either in your machine (if the DNS entry is cached) or in your router, then every time you try to go to that URL your router will end up going to any IP outside your network.

I need put domain with port 80 not 3000 is Solving buy not solving

Any suggestions?

You tell Metabase to run on port 3100 (DMB_JETTY_PORT=3100), but your Nginx config is referencing it at port 3000 (proxy_pass ...)

  1. First setup Metabase so it's only accessible on localhost, meaning you should not be able to access it via
  2. Then setup your Nginx config, so there are no conflict warnings, meaning you should only have a single server-section per server_name+listen.
  3. Then make a proxy_pass http://localhost:3000;
    As described in the documentation:
    Or a slightly more complete configuration as shown here: MySQL SSL connection
  4. After Metabase is available on, then make sure to adjust Site URL in Metabase > Admin > Settings > General, so it matches how Metabase is being accessed.

My issues is about SSL
Can u share correct files for do that
I only resolve
Because https in port 80 is not working
I don't know my error
About 3000 and 3001 is only testing

@mgtrfelipeurrego Post your updated configurations.



i need without ssl is fine for now, because is a local deployment develop instance

@mgtrfelipeurrego Just add this to the server-section of whichever site is running:

    location / {
        proxy_pass http://localhost:3000;

If you cannot get it to work, then I'll recommend that you try getting help in a Nginx forum, since it has nothing to do with Metabase, but just incorrect configuration of Nginx.
Or use Apache if you're more familiar with that. Or any other reverse-proxy like Caddy etc...