Skip to content

Prefect UI overwrites the url of my link Artifact #17977

@liviumanea

Description

@liviumanea

Bug summary

In my prefect deployment I have to run it behind nginx in order to be able to serve the link artifacts and I have to configure prefect as follows so that it works behind nginx:

ENV PREFECT_SERVER_API_BASE_PATH=/prefect/api \
    PREFECT_API_URL=http://localhost:4200/prefect/api \
    PREFECT_UI_API_URL=/prefect/api \
    PREFECT_UI_SERVE_BASE=/prefect

In my flows, I am creating artifacts with the following code:

    await create_link_artifact(
        key="pga-report",
        link="http://localhost:8200/prefect/products/2025/05/04/pga-report.pdf",
        link_text="PGA Report",
        description="""
        # PGA Report

        this is the pga report
        """,
    )

When I go look at this artifact, I see the following data from the backend

{"id":"4a61752c-1735-41c6-a7d7-ea4a16604f24","created":"2025-05-04T19:03:20.506642Z","updated":"2025-05-04T19:03:20.506642Z","key":"pga-report","type":"markdown","description":"\n        # PGA Report\n\n        this is the pga report\n        ","data":"[PGA Report](http://localhost:8200/prefect/products/2025/05/04/pga-report.pdf)","metadata_":null,"flow_run_id":"c6750171-cf29-4089-8a0c-0c79122e8ad4","task_run_id":null}

If I visit localhost:8200/prefect/products/2025/05/04/pga-report.pdf in my browser then I can access the pdf file just fine. If I hover over the link on the artifact page the link looks like this:
http://localhost:8200/prefect/prefect/products/2025/05/04/pga-report.pdf. So it somehow adds another "prefect" in there and I don't know how to stop that. If I click that link, the UI tries to navigate as a single page app to that instead of just rendering the file in a new tab as I would like.

If I add a link that's completely unrelated to my prefect paths, for example

link="https://www.prefect.io/"

Then it's not messing with it.

Also, here is how I'm forwarding traffic with nginx onto Prefect

  server {
    listen 80;

    # Serve static PDFs
    location /prefect/products/ {
      alias /usr/share/nginx/html/products/;
      autoindex on;
    }

    # Proxy to Prefect (UI and API)
    location /prefect {
      proxy_pass http://prefect:4200/prefect;
      proxy_http_version 1.1;

      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;

    }

What I really wanted to do is set the link to something unrelated to prefect like

http://localhost:8200/products/2025/05/04/pga-report.pdf

Version info

Version:             3.3.7
API version:         0.8.4
Python version:      3.13.3
Git commit:          8f86aaee
Built:               Mon, Apr 28, 2025 03:04 PM
OS/Arch:             linux/aarch64
Profile:             ephemeral
Server type:         server
Pydantic version:    2.11.4

Additional context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions