Ask coding questions

← Back to all posts
How do I obtain the IP address of a user in Flask?
h
ProgrammingMyLi (0)

I currently use
request.remote_addr to get an IP Address but I keep getting 172.18.0.1

Is replit blocking this?

Answered by notGilbert (121) [earned 5 cycles]
View Answer
Comments
hotnewtop
notGilbert (121)

Replit uses a proxy that messes with the request's IP address, so that's not possible

ProgrammingMyLi (0)

@notGilbert Do you know of any other way I can rate limit my API? Could I still obtain their User Agent?

notGilbert (121)

@ProgrammingMyLi

maybe you could implement an api key system?

ProgrammingMyLi (0)

@notGilbert i can’t do it since its a website to submit forms and responses

notGilbert (121)

@ProgrammingMyLi user authentication? i guess that's the only way that's allowed on replit

Coder100 (18109)

psst none of this stuff is allowed by tos @notGilbert

Coder100 (18109)

psst you can fix it by making a custom domain so it isn't restricted by replit

but this is against tos, so don't ever publicly release ips.

[deleted]

I mean like if you mess by creating the repl enviorment inside of a repl you could get it working without the proxy interfearing

ANDREWVOSS (187)

@novaflippers The proxy is likely running outside the VM, in which case that wouldn't work.

ANDREWVOSS (187)

As far as I know, you can't collect IP's in replit. It's against the TOS anyway, so if you figure out how to do it you might get your repl removed.