yahoo / CMAK

CMAK is a tool for managing Apache Kafka clusters
Apache License 2.0
11.8k stars 2.5k forks source link

HREFs Break When Proxying #129

Open jranson opened 8 years ago

jranson commented 8 years ago

I would like to integrate Kafka Manager into an existing tools suite we offer to our ops team, by configuring a uri (e.g., /kafka-manager) as a Proxy to the Kafka Manager instance, running at 127.0.0.1:9000. Benefits to this approach include allowing us to require the user login via our Single Sign On system before getting access to Kafka Manager, as well as avoiding the necessary firewall holes for port 9000, among other operational benefits. Our proxy config for Apache looks like this:

<Location "/kafka-manager/">
 ProxyPass http://127.0.0.1:9000/
 ProxyPassReverse http://127.0.0.1:9000/
</Location>

We are finding that the Kafka Manager does not supply urls correctly for CSS and JavaScript src attributes or Hyperlink href attributes when accessing the site via the proxy (e.g., via http://example.com/kafka-manager/). This effectively causes the application to not function.

It looks like the primary problem is that your links and assets are sourced with absolute pathing (e.g., <a href="/addCluster">) when a relative pathing (e.g., <a href="./addCluster">) would be better suited for proxy environments. Another option might be a configuration value for setting a prefix string for SRC and HREF attributes.

patelh commented 8 years ago

You can change the default port by adding -Dhttp.port=8080 . Also for auth, it would be better to implement a play filter and put that in for all requests.

alseddnm commented 8 years ago

@patelh am having same issue, we can't changed default port to 8080 as is already been sued by tomcat.. am facing same difficulties to configure basic auth using apache. @jranson you guys able to make it work?

Thank you..!

patelh commented 8 years ago

I will try to add a basic auth filter which can be configured via the conf file.

patelh commented 8 years ago

@jranson have you looked at this : https://www.playframework.com/documentation/2.4.x/HTTPServer ?

pd47 commented 8 years ago

@jranson I'm trying to add authentication to Kafka-manager (https://github.com/yahoo/kafka-manager). Based on your last update, I've installed the nginx software and added below lines into nginx.conf file. I was able to load the "http://10.177.228.21" - welcome to nginx page successfully. How do I configure nginx to access kafka-manager? Kafka-manager process is running on port 9000 on the same server.

user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';
access_log  /var/log/nginx/access.log  main;
sendfile        on;
#tcp_nopush     on;
keepalive_timeout  65;
#gzip  on;
include /etc/nginx/conf.d/*.conf;

proxy_buffering off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_http_version 1.1; upstream backend { server ip-10-177-228-21.ec2.internal:9001; } server { listen 8080; server_name 10.177.228.21; location /opt/kafka-manager-1.3.0.4/bin/kafka-manager { proxy_pass http://backend/; } } }

AndriiOmelianenko commented 8 years ago

@jranson hi, did you managed to fix the issue?

sowmyaramegowda commented 7 years ago

Is there any update on this?

sowmyaramegowda commented 7 years ago

I am looking for help in ldap integration with kafka manager.. Please let me know, any thoughts on this...

yatharthranjan commented 6 years ago

Hi, just add your relative path to play.http.context in application.conf file.

play.http.context="/kafka-manager/"