Retrieve client ip in custom middleware , enabled context variable but still didn't get the ip address

Welcome to Tyk Community @Athira_CA and thank you for posting your question.

In order to get the IP address of your client, you need to use context variable remote_addr into your request header

Then retrieve this request header in your custom middleware. You can use request.Headers["X-Remote-Addr"] in Javascript Middleware or you can refer to this other community post to use it in Python middleware.

Note:
- Make sure you set enable_context_vars to true in your API definition.
- Context Variables can only be used in 3 Middleware plugins : URL Rewriter, Modify Headers and Body Transforms.