lensesio / schema-registry-ui

Web tool for Avro Schema Registry |
http://lenses.io/product/features
421 stars 112 forks source link

Basic auth in Docker causes CONNECTIVITY ERROR #73

Open pajel opened 6 years ago

pajel commented 6 years ago

When using the following command to run your official docker image everything works fine: docker run --rm -p 8080:8080 -e "SCHEMAREGISTRY_URL=https://user:xxx@url:port" -e "ALLOW_GLOBAL=1" -e "ALLOW_TRANSITIVE=1" -e "ALLOW_DELETION=0" -e "PROXY=1" -e "PORT=8080" landoop/schema-registry-ui:0.9.5

When I add basic auth like this: docker run --rm -p 8080:8080 -e "SCHEMAREGISTRY_URL=https://user:xxx@url:port" -e "ALLOW_GLOBAL=1" -e "ALLOW_TRANSITIVE=1" -e "ALLOW_DELETION=0" -e "PROXY=1" -e "PORT=8080" -e "CADDY_OPTIONS=basicauth / admin admin" landoop/schema-registry-ui:0.9.5

Suddenly I get Url : /api/schema-registry CONNECTIVITY ERROR after I log in with admin/admin. The container logs the following:

172.17.0.1 - - [01/Oct/2018:09:38:29 +0000] "GET /api/schema-registry/config HTTP/1.1" 502 16
172.17.0.1 - - [01/Oct/2018:09:38:30 +0000] "GET /api/schema-registry/subjects/ HTTP/1.1" 502 16

Also, I have noticed the requests actually never hit our Kafka cluster.

After removing the basic auth env var from the docker start command I have to clear my browser cache to make the schema-registry-ui work again.

andmarios commented 6 years ago

Hi @pajel. I think the problem is that you use double basic auth. One is set at the schema-registry-ui docker (at the caddy server) and the other at your schema registry. Now, this is just a guess but as you access the localhost with basic auth headers of admin/admin, caddy has no option but to forward them to the schema registry too, where of course they are wrong.

Unfortunately I can't think of an easy fix right now. Maybe you can try to use the same creds for both Schema Registry and Schema Registry UI. So instead of admin:admin, set user:xxx.

mattmadhavan-gmail commented 9 months ago

Hello, any resolution on this issue?

Thanks Matt