Comments (6)
@gligoran it's now autobuilding from master at dockersamples/visualizer:latest
from docker-swarm-visualizer.
I'm not sure if that's an issue with the code or your configuration. The code looks for window.location.host
+ '/apis', which should return the whole host including the subdomain. You see that at request.js line 4.
from docker-swarm-visualizer.
Hi,
I do not do much javascript development, but from what you described, I believe using window.location.host is the problem.
To clarify, I was referring to subdirectory support, not subdomain. I would like to have one internal subdomain - admin.mydomain.com. On the subdomain i deploy multiple internal tools to subdirectories - so think of other administrative tools like phpmyadmin.
That means I would like to serve as follows:
http://admin.mydomain.com/visualizer
http://admin.mydomain.com/phpmyadmin
This cuts down on managing dns, ssl, and firewall rules for "internal" or ip restricted tools. Normally this is fairly simple with Apache/Nginx/HAProxy proxy http modules. However, what happens with this application is the javascript generated urls will always request /apis at the root of domain, regardless of where it is served from via a proxy.
From what you said about window.location.host + /api - i believe that's the problem.
If i access through a proxy at /visualizer and open the javascript console and do the following, I get:
window.location.host
"admin.mydomain.com"
window.location.href
"http://admin.mydomain.com/visualizer"
This means it goes to http://admin.mydomain.com/api - which does not get proxied correctly. The proxy cannot rewrite this url correctly on reverse proxy, because its generated by the javascript in the user's browser at runtime - it doesn't go through the reverse proxy in a way can be caught by the rewrite.
It seems that using host will always make you write the request to the root of the subdomain - but using href would pick up the subdir too allowing you to proxy from a subdirectory.
To reproduce, here is a stripped down config with HAProxy as follows:
haproxy.cfg
global
log 127.0.0.1 local0 notice
maxconn 1024
daemon
stats socket /tmp/proxystats level admin
resolvers docker
nameserver swarm 127.0.0.11:53
nameserver dnsmasq 127.0.0.1:53
hold valid 1s
defaults
default-server init-addr last,libc,none
log global
mode http
option httplog
option dontlognull
timeout connect 5000
option forwardfor
option http-server-close
frontend http
mode http
timeout client 30000
bind *:80
acl LOCALNET src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
# /phpmyadmin
acl phpmyadmin path_dir /phpmyadmin
use_backend phpmyadmin if phpmyadmin LOCALNET
# /visualizer
acl visualizer path_dir /visualizer
use_backend visualizer if visualizer LOCALNET
backend phpmyadmin
mode http
timeout server 30000
reqirep ^(GET|POST|HEAD)\ /phpmyadmin(.*) \1\ /\2
server phpmyadmin phpmyadmin:80 check resolvers docker resolve-prefer ipv4
backend visualizer
mode http
timeout server 30000
reqirep ^(GET|POST|HEAD)\ /visualizer(.*) \1\ /\2
server docker-swarm-visualizer docker-swarm-visualizer:8080 check resolvers docker resolve-prefer ipv4
docker-compose.yaml
version: "3"
services:
docker-swarm-visualizer:
image: manomarks/visualizer:latest
ports:
- "8081:8080/tcp"
networks:
- internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
haproxy:
image: haproxy:1.7.2-alpine
ports:
- "80:80/tcp"
- "443:443/tcp"
networks:
- internal
volumes:
- "./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg"
deploy:
mode: replicated
replicas: 1
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
environment:
- PMA_HOST=mysql
- PMA_USER=root
- PMA_PASSWORD=password
- PMA_ABSOLUTE_URI=https://admin.mydomain.com/phpmyadmin
networks:
- internal
deploy:
mode: replicated
replicas: 1
networks:
internal:
driver: overlay
from docker-swarm-visualizer.
Ah I see. Thanks for clarifying. It should be easy I'll look into it.
from docker-swarm-visualizer.
+1
seeing the same issue behind NGINX when a location is proxied, i.e. /oam/swarm -> proxy_pass http://swam-visualizer:8080
from docker-swarm-visualizer.
Any plans to release a new version of visualizer that has this fix?
from docker-swarm-visualizer.
Related Issues (20)
- alexellis2/visualizer-arm tag 0.4 missing on Docker Hub HOT 4
- Unable to display content while containers are preparing HOT 5
- Hosting container of this image in AWS ECS cluster HOT 1
- Visualizer displays wrong info if previous tasks failed HOT 6
- Vsualizer for Arm HOT 1
- Docker service creation taking more time HOT 1
- blue screen but showing nothing HOT 8
- Show engine labels on nodes. HOT 1
- docker pull manomarks/visualizer Using default tag: latest Error response from daemon: manifest for manomarks/visualizer:latest not found HOT 1
- Can we have a tag for 1809 please so I can run in-process on win server 2019. HOT 2
- Scaling visualizer HOT 2
- Invalid format conversion
- Not showing anything HOT 4
- running on ARM Raspberry 3B HOT 3
- Showing red but no details are there, how to trace that? HOT 2
- Node is continuosly removed HOT 1
- Make express app Path Aware
- Update node.png HOT 1
- Make it possible use socket-proxy HOT 1
- h.default.findWhere is not a function HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-swarm-visualizer.