How to get client ip address in flask

Flask have 3 methods to retrive client IP 1, request.remote_addr 2, request.environ[‘REMOTE_ADDR’] 3, request.environ[‘HTTP_X_FORWARDED_FOR’] For the first 2 methods request.remote_addr and request.environ[‘REMOTE_ADDR’], we can use it if the server was directly called by clients. But if our sevice behind a proxy, we need to look for the “X-Forwarded-For” header for the client IP. Which means … Read more

How MySQL show, grant or revoke user privileges

I wrote this post to memo the basic MySQL commands to show, grant, or revoke user privileges. Firstly, let’s show all users and hosts of my current MySQL instance by the following command: 1, Show Privileges for a user in MySQL Also, we can check the permissions for the currently logged in user with: 3, … Read more

AccessDeniedException: 403 Request is prohibited by organization’s policy. vpcServiceControlsUniqueIdentifier

We may be facing this error when performing actions on Google Cloud Platform You could find further information about the error by search the error_indicator in Console Logs Usually, It was caused by violation of the VPC Service Control rules. For example, you access the resource which is a untrusted project, and you could fix it by … Read more