View Issue Details

IDProjectCategoryView StatusLast Update
0001967XdebugUncategorizedpublic2021-04-28 05:48
ReporterPatrick Kaiser Assigned Toderick  
Status assignedResolutionopen 
Summary0001967: xdebug.client_discovery_header not working
DescriptionI've tried now many times to set the client_discovery_header in xdebug 3.0.4 when running apache + modphp

Here is my xdebug config:
xdebug.client_host = host.docker.internal
xdebug.start_with_request = yes
xdebug.discover_client_host = true
xdebug.client_port = 9000
xdebug.start_with_request = yes
xdebug.client_discovery_header = FORWARD_HOST
Steps To Reproducecurl -v -H 'XDEBUG_SESSION: 1' -H 'FORWARD_HOST:' -H 'X-HTTPS: on' -H 'Host:' <IP-OF-SERVER>:<PORT-OF-APACHE>/phpinfo.php

In the output of phpinfo() i can see, that the HTTP HEADER FORWARD_HOST is found and stored with correct test value of

The output of apache/xdebug is:
[Thu Apr 22 09:04:49.903176 2021] [php:notice] [pid 16] [client] Xdebug: [Step Debug] Could not connect to debugging client. Tried: (from REMOTE_ADDR HTTP header), host.docker.internal:9000 (fallback through xdebug.client_host/xdebug.client_port) :-(

(where is my ip from which i am connecting to the apache)
It looks like:
a) the header FORWARD_HOST is not used (i also tried with different namings like HTTP_XDEBUG_IP)
b) the information gets overwritten, as soon as REMOTE_ADDR is set
TagsNo tags attached.
Operating SystemUbuntu 18.04
PHP Version8.0.0-8.0.4



2021-04-27 13:57

administrator   ~0005863

PHP automatically adds `HTTP_` in front of HTTP header names when storing them in the `$_SERVER` array. In your case, that means that the `FORWARD_HOST` header that you request with cURL ends up having to be `HTTP_FORWARD_HOST` as `xdebug.client_discovery_header` value. This should therefore work if you set:

 xdebug.client_discovery_header = HTTP_FORWARD_HOST

Let me know if that does the trick?

The documentation is indeed unclear about this, and I will update this.

Patrick Kaiser

2021-04-28 05:48

reporter   ~0005865

Sadly it does not do the trick but helped me a step forward ;)

FORWARD_HOST was not in var_dump($_SERVER). Looks like you need to use different variables. Also there is a weird thingy about using `-` in the request and it gets converted to `_` but using `_` directly is not working.
So anyway the working version is to use:
curl -H 'XDEBUG_IP:' ....
and in the xdebug config
xdebug.client_discovery_header = HTTP_XDEBUG_IP

Hope this will safe someone else time ;)

thanks for your support derick

Issue History

Date Modified Username Field Change
2021-04-22 07:34 Patrick Kaiser New Issue
2021-04-27 13:57 derick Assigned To => derick
2021-04-27 13:57 derick Status new => feedback
2021-04-27 13:57 derick Note Added: 0005863
2021-04-28 05:48 Patrick Kaiser Note Added: 0005865
2021-04-28 05:48 Patrick Kaiser Status feedback => assigned