Skip to content

Enable swagger behind proxy#301

Open
fjugipe wants to merge 4 commits intomainfrom
issue-290_proxy-host-middleware
Open

Enable swagger behind proxy#301
fjugipe wants to merge 4 commits intomainfrom
issue-290_proxy-host-middleware

Conversation

@fjugipe
Copy link
Contributor

@fjugipe fjugipe commented Mar 10, 2026

Description

After this pull request:

  • Swagger documentation is directed to the correct path and is able to get the openapi.json
  • Using the API queries via Swagger execute will be correctly directed to the proxys url

Features

  • Add x-forwarded-headers middleware to handle the requests with known proxies
  • Add UvicornWorkerWithForwardedHeaders uvicorn worker to disable default proxy header handling with gunicorn
    • gunicorn does not have --proxy-headers option in startup like uvicorn does
      --proxy-headers / --no-proxy-headers
                                    Enable/Disable X-Forwarded-Proto,
                                    X-Forwarded-For, X-Forwarded-Port to
                                    populate remote address info.
    

closes #290

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Title Coverage Tests Skipped Failures Errors Time
API Unit Tests Coverage 47 0 💤 0 ❌ 0 🔥 1.676s ⏱️
Ingest Unit Tests Coverage 16 0 💤 0 ❌ 0 🔥 2.502s ⏱️

api/main.py Outdated
)
add_metrics(app)

trusted = os.getenv("FORWARDED_ALLOW_IPS", "127.0.0.1,::1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not my intention and fixed with 8664d55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API] Openapi documentation in multiple proxy situations

2 participants