Get IP of incoming HTTP request

Ccrafterr5/15/2023
Is there a way to get incoming HTTP requests? Attempting to get the IP results in the IP of the railway proxy being returned. Is there a header or something I can grab?
Ccrafterr5/15/2023
N/A
Ccrafterr5/15/2023
cool thanks
Bbrody5/15/2023
no problem!
Ccrafterr5/16/2023
@Brody Do you know if using a cloudflare proxy affects this?
Bbrody5/16/2023
if you use a custom domain with a cloudflare proxy, you will now get a cloudflare IP as the A type, and i am pretty sure thats still not a static ip
Ccrafterr5/16/2023
Railway doesn't replicate the X-Forwarded-For header from Cloudflare?
Ccrafterr5/16/2023
Shame.
Bbrody5/16/2023
really? railways proxy doesn't pass cloudflare's X-Forwarded-For header through to its own X-Forwarded-For header?
Ccrafterr5/16/2023
Testing that now.
Ccrafterr5/16/2023
Nevermind. It indeed does.
Bbrody5/16/2023
fiber 💀
Ccrafterr5/16/2023
I love Fiber.
Ccrafterr5/16/2023
I like the Express feel.
Bbrody5/16/2023
💀
Ccrafterr5/16/2023
Also it's faster than Gin.
Bbrody5/16/2023
stdlib is faster than gin
Bbrody5/16/2023
gin is bloat
Ccrafterr5/16/2023
Which is why I use Fiber.
Bbrody5/16/2023
just dont try to send or receive large files
Ccrafterr5/16/2023
What happens then?
Bbrody5/16/2023
by default fasthttp will buffer it into memory
Bbrody5/16/2023
sometimes even doublebuffer
Bbrody5/16/2023
want to send a 100mb file to a client? well now your mem usage just increased 200mb
Ccrafterr5/16/2023
Fun.
Ccrafterr5/16/2023
Good thing I cap my files at 10mb.
Bbrody5/16/2023
i even speed limit uploads and downloads from the apis, theres no need for that dude with 10gig fiber internet to sap up all the bandwidth
Ccrafterr5/16/2023
Haha.
Bbrody5/16/2023
so all good now?
Bbrody5/16/2023
fiber has a real ip middleware right
Bbrody5/16/2023
app := fiber.New(fiber.Config{
  ProxyHeader: fiber.HeaderXForwardedFor,
})
Bbrody5/16/2023
thats how its done with fiber
Ccrafterr5/16/2023
I just did this.
Ccrafterr5/16/2023
c.Get("X-Forwarded-For")
Bbrody5/16/2023
perfect
Bbrody5/16/2023
oh not perfect
Ccrafterr5/16/2023
Fixed.
Bbrody5/16/2023
do this, then you can just do c.IP() in a handler