'k8s ingress: check whether a request is come from internal or public network

For example, I have following ingress:

annotations:
  kubernetes.io/ingress.class: alb
  alb.ingress.kubernetes.io/scheme: internal
rules:
  - host: internal.subnet
...
annotations:
  kubernetes.io/ingress.class: alb
  alb.ingress.kubernetes.io/scheme: internet-facing
rules:
  - host: something.com

How do I distinguish the requests are from internet-facing or internal?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source