openclimatefix / openclimatefix/quartz-api

Set FORWARDED_ALLOW_IPS so request.url gets the right scheme behind the load balancer

Open Beginner friendly
#393 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10
Forks
32
Avg merge
1d 3h
Merged PRs (30d)
13

Description

request.url is http on deployed environments, because TLS is terminated at the load balancer and the container is spoken to over http. gunicorn's UvicornWorker only trusts X-Forwarded-Proto from forwarded_allow_ips, which defaults to loopback, so the header is ignored and the scheme is wrong everywhere a URL is built from the request.

#392 works around it for the one case that was visible — the Scalar OAuth redirect URL, which was handing Auth0 an http:// callback on dev — by reading X-Forwarded-Proto directly. Anything else deriving a URL from request.url still has it.

Setting FORWARDED_ALLOW_IPS on the container fixes it properly and lets the workaround come back out. It's a deployment change rather than a code one, hence a separate issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the container or deployment configuration where environment variables are set for the deployed API. Set FORWARDED_ALLOW_IPS there and verify that request.url uses the forwarded scheme behind the load balancer. Confirm that the workaround from #392 can then be removed without breaking the Scalar OAuth redirect URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.