Understanding How to Obtain Client-Side Source IP (Global IP) on the WEBAPP side that is Booting on EC2

Asked 2 years ago, Updated 2 years ago, 147 views

Thank you for your help.
About the title, when you press a button on the web app,
Obtain client-side (me) global IP and
I would like to register with RDS.
I have obtained the global IP by filling the following URL in the program.
This is a situation where the IP that seems to be EC2's global IP? has been obtained.

https://api.ipify.org/?format=json

Obtaining the client's global IP on the app side running on EC2 is
Is it impossible?If there is a solution, please contact
Could you teach me?Thank you for your cooperation.

javascript python3 aws vue.js

2022-09-30 19:13

1 Answers

Learn how to obtain client IP on the server side.

There are many configurations of EC2.
Are you using ALB (ELB), Nginx, or what is the framework of the web application?
I can't say this because it doesn't say that, but I will answer the principle.

The IP address from which it is accessed will arrive in the HTTP header to the final server process, but will be replaced by the address of that server if it is halfway through a load balancer or reverse proxy.Therefore, settings for delivering the original IP address are provided in those intermediate server settings.

See the following values in the HTTP request header:

REMOTE_ADDR

X-Forwarded-Forwarded

X-REAL-IP

The following articles are helpful.


2022-09-30 19:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.