#Get IP of incoming HTTP request

40 messages · Page 1 of 1 (latest)

versed granite
#

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?

twilit kilnBOT
#

Project ID: N/A

versed granite
#

N/A

pine swan
versed granite
#

cool thanks

pine swan
#

no problem!

versed granite
#

@pine swan Do you know if using a cloudflare proxy affects this?

pine swan
#

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

versed granite
#

Railway doesn't replicate the X-Forwarded-For header from Cloudflare?

#

Shame.

pine swan
#

really? railways proxy doesn't pass cloudflare's X-Forwarded-For header through to its own X-Forwarded-For header?

versed granite
#

Testing that now.

#

Nevermind. It indeed does.

pine swan
#

fiber 💀

versed granite
#

I love Fiber.

#

I like the Express feel.

pine swan
#

💀

versed granite
#

Also it's faster than Gin.

pine swan
#

stdlib is faster than gin

#

gin is bloat

versed granite
#

Which is why I use Fiber.

pine swan
#

just dont try to send or receive large files

versed granite
#

What happens then?

pine swan
#

by default fasthttp will buffer it into memory

#

sometimes even doublebuffer

#

want to send a 100mb file to a client? well now your mem usage just increased 200mb

versed granite
#

Fun.

#

Good thing I cap my files at 10mb.

pine swan
#

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

versed granite
#

Haha.

pine swan
#

so all good now?

#

fiber has a real ip middleware right

#
app := fiber.New(fiber.Config{
  ProxyHeader: fiber.HeaderXForwardedFor,
})
#

thats how its done with fiber

versed granite
#

c.Get("X-Forwarded-For")

pine swan
#

perfect

pine swan
versed granite
#

Fixed.