Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

x-forwarded-for

How to configure nginx X-Forwarded-Port to be the originally request port

August 10, 2023 by Tarik

The only workaround I’ve found is to use a map rule to get the port from the http_host variable e.g. map $http_host $port { default 80; “~^[^\:]+:(?<p>\d+)$” $p; }

Categories docker Tags docker, nginx, nginx-reverse-proxy, reverse-proxy, x-forwarded-for Leave a comment

FastAPI (starlette) get client real IP

July 23, 2023 by Tarik

request.client should work, unless you’re running behind a proxy (e.g. nginx) in that case use uvicorn’s –proxy-headers flag to accept these incoming headers and make sure the proxy forwards them.

Categories python Tags fastapi, python, starlette, x-forwarded-for Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa