Closed marcusball closed 3 weeks ago
I would take a PR to fix this. FYI you probably will need to rewrite the host header in your reverse proxy because, as a security precaution, Node blocks (or at least blocked, https://github.com/microsoft/vscode-js-debug/commit/84a429bfe73c5fd9128889c8f51bbb6c4cc07aa2) inspector requests that contain non-local Host headers.
Issue
My issue is similar to the one described in #778. I am trying to run and debug a Node server which sits behind a reverse proxy. At the time of the aforementioned issue, the debugger always set the host to
localhost
regardless of the configuredaddress
, which made it impossible to a debugger server behind a reverse proxy. TheremoteHostHeader
option was added in #1664 which fixed most of that problem, allowing for a custom Host header when connecting to the websocket of the debug server.My issue is that config option only applies to the websocket connection, but when vscode begins debugging and it tries to find the websocket url, it still forces the
host
header to belocalhost
.What this means is that I can not connect to the debugger by having VS Code discover the websocket url. Here's an example of that configuration:
And this is the request sent when code tries to discover the websocket:
Code, however, can successfully connect to the debug server if you manually specify the websocket address, as in this example:
The problem there is that is very inconvenient since the websocket address changes every time the server is restarted, so this isn't a really maintainable solution.
Proposed feature
The simplest solution is to update the calls to
fetchJsonWithLocalhostFallback
to pass in theremoteHostHeader
config value, and allow it to overridelocalhost
in the same fashion as the websocket connection.I can't really imagine that would cause any issues or regressions unless someone managed to create a convoluted set up that discovers over localhost but connects via a reverse proxy.
If this seems like a reasonable request, I'd be willing to try to get it implemented and open a PR for it, but I'd want to get a general OK and iron out any potential concerns before I'd attempt to do so.