xdebug running on remote host: cannot connect back to client -> timeout

since two days i try to get my xdebug configuration running without succes what drives me crazy!

my setup

Client: Macbook Pro with Phpstorm

Xdebug is running on a remote server ( ubuntu 18.04 ) in a Docker ( latest stable version ) container behind the jwilder/nginx proxy.

Xdebug runs on php7.3.9, xdebug version is 2.7.2

Xdebug Settings:

xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remode_mode=req
xdebug.remote_handler=dbgp
xdebug.remote_port=10000
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
xdebug.remote_log=/var/log/xdebug.log

the xdebug.remote_host is docker.host.internal because i copied my config file from my local xdebug.ini. on mac you use this value. in this case xdebug.remote_host will be ignored because xdebug.remote_connect_back is on.

this is the phpinfo page

phpinfo

this is the output in my xdebug log file

[17] Log opened at 2019-09-07 07:40:29
[17] I: Checking remote connect back address.
[17] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[17] I: Remote address found, connecting to 178.203.235.46:10000.
[17] E: Time-out connecting to client (Waited: 200 ms). :-(
[17] Log closed at 2019-09-07 07:40:29

this is my remote xdebug validation in phpstorm
xdebug validation in phpstorm

its seems like everything should run – phpstorm is setup correctly ( listening on port 10000 ) – but its not!!!

what have i tried: almost everything. i used older xdebug versions, other php versions…nothing. always the timeout when xdebug wants to connect to my client.

also i disabled xdebug.remote_connect_back and used the HTTP_X_REAL_IP as xdebug.remote_host –> timeout.

then i thought maybe its the nginx proxy. so i tried it without it -> same error .. timeout.

what am i doing wrong?

Source: StackOverflow