Does anyone know how to pass client IP from my local computer to a remote VM host (Debian 11, don't have GUI on it and don't want to have it) where Minikube is installed, minikube has MySQL and phpmyadmin services (phpmyadmin pod/container among phpmyadmin has on path var/www/html/my_path/ where php files of my PHP app are) ..Phpmyadmin service I access on local computer via port forwarding from remote VM, I access it through port 80.Ingress is also accessed through port forwarding from a remote VM, I access it through port 443.Why port forwarding? Because NodePort or LoadBalncer, minikube tunnel approach did work, most people on tutorials and the net say expose it through NodePort then use it in the browser.
The result of the minikube service some-service --url command or URL in the browser: minikube_ip:nodeport_service_port - which is ok if minikube is on your local machine, otherwise it doesn't work, so that's why port forwarding and it works.
In index.php (login form - in my minikube based php app) added these lines:
$clientIP = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']);echo "<br><br>Client IP Address: " . $clientIP. "<br>";foreach (getallheaders() as $name => $value) { echo "$name: $value <br>";}echo "<br><br>*************************************<br><br> " . $clientIP. "<br>";$clientIP2 = isset($_SERVER['X-ORIGINAL-FORWARDED-FOR']) ? $_SERVER['X-ORIGINAL-FORWARDED-FOR'] : $_SERVER['sdfREMOTE_ADDR'];echo "<br><br>X-Original-Forwarded-For: " . $clientIP2. "<br>";echo "<br> php_uname :<br>";echo php_uname();var_dump($_SERVER);
I traversed all and tried all with online AI apps and basic net support and made modifications across ingress yaml, nginx.conf in ingress pod/container, regular logs, error logs, after regular (minikube addons enable ingress) install of ingress made helm installation of Ingress, changed nginx.conf and ingress and configmap yaml of Ingress pod that is used with phpmyadmin pod .. to no avail.
Still no success in seeing my real local IP in minikube php app accessed via local web browser instead of:
Client IP Address: 127.0.0.1X-Real-IP: 127.0.0.1X-Forwarded-For: 127.0.0.1
thx