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

PREFIX does not change path for static files #7

Open
rayjlinden opened this issue Sep 22, 2020 · 10 comments
Open

PREFIX does not change path for static files #7

rayjlinden opened this issue Sep 22, 2020 · 10 comments
Labels
backlog Backlog enhancement New feature or request

Comments

@rayjlinden
Copy link

I'm trying to put the ui behind a proxy.

I set URL_PREFIX: "/allureui"

However, the page once it loads is trying to get assets like:
/static/js/2.305ecc37.chunk.js

Is there something I can do to serve the assets out the url_prefix as well?

@fescobar
Copy link
Owner

fescobar commented Sep 22, 2020

@rayjlinden what proxy are you using? and what is your configuration? are you using Kubernetes?
did you try adding after prefix /allure-docker-service-ui/ like this?
http://${IP}:${PORT}/allureui/allure-docker-service-ui/

@fescobar fescobar added question Further information is requested waiting for answer Waiting for user's answer labels Sep 22, 2020
@rayjlinden
Copy link
Author

rayjlinden commented Sep 22, 2020 via email

@fescobar
Copy link
Owner

@rayjlinden you have to set up a little different when it's a Single Page Aplication (SPA). Fortunately, it's work for you.
I will see how can I improve that part because as you said I'm not totally convinced how it's working now.

@fescobar fescobar added backlog Backlog enhancement New feature or request and removed question Further information is requested waiting for answer Waiting for user's answer labels Sep 23, 2020
@oleksandr-hyuna
Copy link

Same with Nginx:
docker-compose

version: '3'
services:
  allure:
    image: "frankescobar/allure-docker-service"
    environment:
      CHECK_RESULTS_EVERY_SECONDS: 1
      KEEP_HISTORY: 1
      URL_PREFIX: "/allure"
    ports:
      - "5050:5050"
    volumes:
      - /etc/allure/allure-results:/app/allure-results
      - /etc/allure/allure-reports:/app/default-reports
  allure-ui:
    image: "frankescobar/allure-docker-service-ui"
    environment:
      ALLURE_DOCKER_PUBLIC_API_URL: "http://nginx.domain.com"
      ALLURE_DOCKER_PUBLIC_API_URL_PREFIX: "/allure"
      URL_PREFIX: "/allureui"
    ports:
      - "5252:5252"

Works only with separate env-config.js and static route:

    location /allure/ {
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://allure:5050;
    }
    location /allureui/ {
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://allure:5252;
    }
    location /env-config.js {
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://allure:5252;
    }
    location /static/ {
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://allure:5252;
    }

That's can conflict with my "location /" that is not ok as for me

@fescobar
Copy link
Owner

Thanks @oleksandr-hyuna for the info. I will use this when I try to fix this problem. It's in the backlog.

@sharmau5
Copy link

Facing the same issue. I am using Istio virtual services and have to map the root / location to the ui to get the static assets to load. A fix will be great as this is not going to work long-term.

    - match:
        - uri:
            prefix: /ids-reports-api
      rewrite:
        uri: /
      route:
        - destination:
            host: ids-reports
            port:
              number: 5050
    - match:
        - uri:
            prefix: /ids-reports-ui
      route:
        - destination:
            host: ids-reports
            port:
              number: 5252
    - match:
        - uri:
            prefix: /
      route:
        - destination:
            host: ids-reports
            port:
              number: 5252

@sk-idwell
Copy link

@fescobar There's a base tag in index.html file which makes all links relative to the server root. It appears that it's not really necessary for the app to work. It's elimination can fix this issue.

@alb3ric
Copy link

alb3ric commented May 12, 2023

Hello,

Any news about this issue ?
I got the same behavior with traefik.

I set this in my docker-compose for allure routing :

 - "traefik.http.routers.allureui.rule=Host(`my.example.com`) && PathPrefix(`/allure/`)"

I set :

  environment :
    - URL_PREFIX: "allure"

But when I connect to my.example.com/allure I have error concerning loading the static files.
Is it link to this issue or am I doing something wrong in my docker-compose ?

@khanzzirfaniag
Copy link

khanzzirfaniag commented May 15, 2023

Hello @fescobar any ETA for the static files for URL_PREFIX to work? I have deployed on k8s and it fails for static path.
image

as other UI works with correctly having base url_prefix

image

@fescobar
Copy link
Owner

Hi everybody
You can try forking the project and trying your solution.
This is not a simple bug. It depends on how you set up the configuration in your environment.
A few years ago Kubernetes didn't support Static webpages properly, you needed to hack a little to have that working. At the moment not sure if Kubernetes supports that properly.
I think the proper way to fix that it's moving from ReactJS (Single Server Application) to NextJS (Server Side Rendering) which is a big task.
If someone can find a solution is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Backlog enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants