ProxyPass for webui

1,335 views
Skip to first unread message

Alvaro Miranda Aguilera

unread,
Sep 23, 2014, 8:59:15 PM9/23/14
to consu...@googlegroups.com
Hello There,

I am starting to play with Consul, and will like to check if I am hitting an issue or I am misreading the documentation.

I did a nginx proxy pass for  server/ui -> http://localhost:8500/ui

and found that the ui client is asking /v1/... pages

so I end with 2 proxy pass entries:


is this OK? Will I need at somepoint other entries?

Thanks,
alvaro.

Armon Dadgar

unread,
Sep 24, 2014, 7:44:56 PM9/24/14
to Alvaro Miranda Aguilera, consu...@googlegroups.com
Hey Alvaro,

Those are the only two important prefixes currently! The UI directory is actually
just static files, so if you want, you can have Apache/Nginx serve those directly
instead of doing a proxy to Consul.

Best Regards,
Armon Dadgar
--
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alvaro Miranda Aguilera

unread,
Sep 24, 2014, 8:07:14 PM9/24/14
to Armon Dadgar, consu...@googlegroups.com
Thanks Armon,

My trouble is I am behind corporate firewall and my test bed is on the internet, so did try to setup the ui behind a webserver and run into this issue.

do you want me to send a PR to put these bits on the ui doc?

I did test putting the web_ui directory directly on nginx and worked.

one note, the code of the ui have this everywhere:

getJSON("/v1/..

so, /v1/ must be local to the webserver also

2 options

if the webserver have consul locally, a proxy_pass /v1 -> localhost:8500/v1 will do the trick

if the web browser doesn't have consul locally, then -client  to valid ip or 0.0.0.0, plus a proxy_pass /v1 -> remote:8500/v1



Alvaro.

Armon Dadgar

unread,
Sep 24, 2014, 8:09:07 PM9/24/14
to Alvaro Miranda Aguilera, consu...@googlegroups.com
Alvaro,

Yep we use the same trick for the cluster at demo.consul.io.
Using the proxy pass seems to be the simplest way to do it.

DanyC

unread,
Jul 16, 2015, 7:02:19 AM7/16/15
to consu...@googlegroups.com, kik...@gmail.com
Hi Armon,

Any chance you could share the snippet of the proxy_pass for nginx?

I'm trying the same trick where consulUI dist/* are stored on the consul server and i only want to redirect entries from nginx to consulUI (no interest to store them onto nginx server)

Any help much appreciated!

Dani

DanyC

unread,
Jul 16, 2015, 7:41:59 AM7/16/15
to consu...@googlegroups.com, kik...@gmail.com
If anyone is interest/ comes across this topic they can see the nginx cfg

 # Consul
        location /consul/ {
                expires off;
                proxy_pass  http://<consuUI server>:8500/ui/;
        }

        location /v1/ {
                expires off;
                proxy_pass  http://<consuUI server>::8500/v1/;
        }

Just a reminder that the consulUI dist/* is not on the nginx server

HTH,

Dani

On Thursday, 25 September 2014 01:09:07 UTC+1, Armon Dadgar wrote:
Reply all
Reply to author
Forward
0 new messages