Skip to content

Commit

Permalink
Accept X-Forwarded-For header
Browse files Browse the repository at this point in the history
Ideally we'd set it to our nginx ingress that sets it but we can't easily know the IP
from the running API pod (it's a kube-system daemonset).
Also, uvicorn only supports direct IP and cannot compute CIDR
> https://github.com/encode/uvicorn/blob/fc2130bf1a740acaa502530079bfbd595fa7a94c/uvicorn/middleware/proxy_headers.py#L56

So we are accepting the first value of X-Forwarded-For header.
Thankfully, nginx-ingress by default strips it so it cant be spoofed.
> https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#use-forwarded-headers
  • Loading branch information
rgaudin committed Aug 31, 2023
1 parent c14903d commit ff36ba8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions nautilus/api/api-configs.cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ data:
CHUNK_SIZE: "2MiB"
REDIS_URI: "redis://redis-service:6379/0"
CHANNEL_NAME: "s3_upload"
FORWARDED_ALLOW_IPS: "*"

0 comments on commit ff36ba8

Please sign in to comment.