consul icon indicating copy to clipboard operation
consul copied to clipboard

Consul UI doesnt support nginx reverse proxy

Open JeevanAleti opened this issue 3 years ago • 2 comments

When upgrading consul from 1.0.6 to later versions the nginx reverse proxy doesnt support and it displays an empty UI

Nginx.conf file

server { include /etc/nginx/mime.types; listen 443 default_server ssl; index index.html; autoindex off; server_name _; # configure proxy timeout globally proxy_connect_timeout 60s; proxy_send_timeout 900s; proxy_read_timeout 900s; proxy_pass_request_headers on; # Note: default is on real_ip_recursive on; proxy_intercept_errors on; client_max_body_size 0; # No limit location = /consul { port_in_redirect off; rewrite /.* /consul/ui/# redirect; } location = /consul/ { port_in_redirect off; rewrite /.* /consul/ui/# redirect; } location ~ ^/consul/.* { root /usr/share/nginx/html; proxy_redirect / /consul; sub_filter_types application/x-javascript; sub_filter '"/v1/' '"/consul/v1/'; sub_filter_once off; rewrite ^/consul/(.*) /$1 break; proxy_pass http://consul; } }

this is working at https://test.dev.io/consul URL for 1.0.6 version, but after upgrading it to later versions I see below error in logs file

open() "/etc/nginx/html/ui/assets/vendor-992465b8b230f89d4adce5f016543c4d.css" failed (2: No such file or directory)

I see below Request URL not found 404 error in console https://test1.dev.io/ui/assets/consul-ui-773e564a696ff5c2b8729d01b80ac645.js

Below is my consul config file

bind_addr = "0.0.0.0" client_addr = "0.0.0.0" server = true bootstrap_expect = 1 ui = true ports = { #dns = 53 http = 8500 } disable_update_check = true data_dir = "/consul" addresses = { http = "0.0.0.0" https = "0.0.0.0" } node_name = "test1"

But when I expose consul on port 8500 its working, is there anything I am missing here, please suggest.

JeevanAleti avatar Jul 27 '22 20:07 JeevanAleti

Hey @JeevanAleti

What consul version are you upgrading to? We've had a lot of releases since 1.0.6, so depending on the version you may need to preform some other tasks to get everything working correctly.

Amier3 avatar Aug 04 '22 17:08 Amier3

Hi Amier,

First I tried upgrading from 1.0.6 to 1.8.0 and it didnt work. Then I started upgrading from 1.0.6 to 1.0.7 to 1.1.0 to 1.1.1 and I have same issues at 1.1.1, it just displays empty UI image

This is what I see when I do some debug: consuV1 8 0-error

Is there any other config that I need to add

JeevanAleti avatar Aug 04 '22 17:08 JeevanAleti

Hi @JeevanAleti,

I saw that you created issue #14243 about other difficulties you're facing when trying to proxy the Consul UI through nginx. This seems to be related issue. Do you mind if we close one of these and consolidate the conversation on one issue?

blake avatar Aug 17 '22 21:08 blake

Hi @blake, yes please, thank you

JeevanAleti avatar Aug 17 '22 21:08 JeevanAleti