Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web UI ignores SERVER_SERVLET_CONTEXT_PATH environment variable after #2153 #2346

Closed
ashevtsov-wawa opened this issue Jul 26, 2022 · 6 comments · Fixed by #2363
Closed

Web UI ignores SERVER_SERVLET_CONTEXT_PATH environment variable after #2153 #2346

ashevtsov-wawa opened this issue Jul 26, 2022 · 6 comments · Fixed by #2363
Assignees
Labels
scope/frontend status/accepted An issue which has passed triage and has been accepted status/confirmed A bug which actuality is confirmed type/bug Something isn't working type/regression Something that has been previously fixed but got broken again
Milestone

Comments

@ashevtsov-wawa
Copy link

Describe the bug
Before #2153 was merged Kafka UI used to render pages using base path as set by SERVER_SERVLET_CONTEXT_PATH (i.e. /kafka-ui in our case).
After #2153 index.html returns links to resources without the base path

Set up
How do you run the app? Please provide as much info as possible:
Docker container created from provectuslabs/kafka-ui:1b71ccb9755041e18ff540d5c57318243b38876d image

Steps to Reproduce
Steps to reproduce the behavior:

  1. Create Docker container passing SERVER_SERVLET_CONTEXT_PATH=/kafka-ui environment variable
    docker run -p 8080:8080 \
         -e KAFKA_CLUSTERS_0_NAME=local \
         -e KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092 \
         -e SERVER_SERVLET_CONTEXT_PATH=/kafka-ui \
         -d provectuslabs/kafka-ui:1b71ccb9755041e18ff540d5c57318243b38876d
    
  2. Open main page - curl -sS http://localhost:8080/kafka-ui/
  3. Observe that links returned in the main page do not include /kafka-ui/ prefix
    Example:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="/favicon.ico" sizes="any"><!-- 32×32 -->
    <link rel="icon" href="/favicon/icon.svg" type="image/svg+xml">
    <link rel="apple-touch-icon" href="/favicon/apple-touch-icon.png"><!-- 180×180 -->
    <link rel="manifest" href="/manifest.json" />

    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>UI for Apache Kafka</title>
    <script type="text/javascript">
      window.basePath = "";
    </script>
    <script type="module" crossorigin src="/assets/index.e3fb6b5d.js"></script>
    <link rel="modulepreload" href="/assets/venod.29ff7209.js">
    <link rel="modulepreload" href="/assets/lodash.146e3116.js">
    <link rel="stylesheet" href="/assets/index.ea5bd143.css">
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>

  </body>
</html>

Expected behavior
Links should include prefix specified in SERVER_SERVLET_CONTEXT_PATH environment variable
Example:

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <link rel="icon" href="./favicon.ico" sizes="any">
    <link rel="icon" href="./favicon/icon.svg" type="image/svg+xml">
    <link rel="apple-touch-icon" href="./favicon/apple-touch-icon.png">
    <link rel="manifest" href="./manifest.json" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <title>UI for Apache Kafka</title>
    <script type="text/javascript">window.basePath = "/kafka-ui"</script>
    <script defer="defer" src="/kafka-ui/static/js/main.26d94848.js"></script>
    <link href="/kafka-ui/static/css/main.bf915e18.css" rel="stylesheet">
</head>

<body><noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
</body>

</html>

Additional context
The image from the prior commit works as expected - provectuslabs/kafka-ui:d859dd6b3f4bcdcc9143a2e02695eca95be0fd9f

❯ docker run -p 8080:8080 -e KAFKA_CLUSTERS_0_NAME=local -e KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092 -e SERVER_SERVLET_CONTEXT_PATH=/kafka-ui -d provectuslabs/kafka-ui:d859dd6b3f4bcdcc9143a2e02695eca95be0fd9f
Unable to find image 'provectuslabs/kafka-ui:d859dd6b3f4bcdcc9143a2e02695eca95be0fd9f' locally
d859dd6b3f4bcdcc9143a2e02695eca95be0fd9f: Pulling from provectuslabs/kafka-ui
59bf1c3509f3: Already exists
50806c9650be: Already exists
d47367f99f01: Pull complete
Digest: sha256:15152c3d122a76cbb182452db16fed24004d5bc1f38ce41e637eed7dafa9b93f
Status: Downloaded newer image for provectuslabs/kafka-ui:d859dd6b3f4bcdcc9143a2e02695eca95be0fd9f
5d107f9f29e9f9d848a92944bb93fc231169357910104687266a20509d4984d4
❯ curl -sS http://localhost:8080/kafka-ui/
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico" sizes="any"><link rel="icon" href="./favicon/icon.svg" type="image/svg+xml"><link rel="apple-touch-icon" href="./favicon/apple-touch-icon.png"><link rel="manifest" href="./manifest.json"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>UI for Apache Kafka</title><script type="text/javascript">window.basePath="/kafka-ui"</script><script defer="defer" src="/kafka-ui/static/js/main.6f6697ad.js"></script><link href="/kafka-ui/static/css/main.d0feaa17.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@ashevtsov-wawa ashevtsov-wawa added status/triage Issues pending maintainers triage type/bug Something isn't working labels Jul 26, 2022
@Haarolean
Copy link
Contributor

Hey, thanks for reaching out. We'll take a look ASAP.

@Haarolean Haarolean added scope/frontend status/accepted An issue which has passed triage and has been accepted status/confirmed A bug which actuality is confirmed type/regression Something that has been previously fixed but got broken again and removed status/triage Issues pending maintainers triage labels Jul 28, 2022
@Haarolean Haarolean added this to the 0.5 milestone Jul 28, 2022
Haarolean added a commit that referenced this issue Jul 28, 2022
This was linked to pull requests Jul 28, 2022
@Haarolean
Copy link
Contributor

Done, the fix is available in master-labeled image. We had to get rid of dynamic chunks loading but we'll think of something later.

@Amarmandal
Copy link

@Haarolean When we use AUTH_TYPE as "Login Form" the sigin page do not load bootstrap css. It is still not returning the base path set to SERVER_SERVLET_CONTEXT_PATH.

image

@Haarolean
Copy link
Contributor

@Amarmandal #4178

@alba-ado
Copy link

Any updates?

@germanosin
Copy link
Contributor

Me and @Haarolean no longer support this repo, don't you mind to post this to https://github.com/kafbat/kafka-ui

@workshur workshur removed their assignment Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope/frontend status/accepted An issue which has passed triage and has been accepted status/confirmed A bug which actuality is confirmed type/bug Something isn't working type/regression Something that has been previously fixed but got broken again
Projects
None yet
6 participants