marcellourbani / vscode_abap_remote_fs

Remote filesystem for ABAP systems
MIT License
172 stars 28 forks source link

Failed to connect to SYS:Cannot set headers after they are sent to the client #180

Open AlexanderK22 opened 2 years ago

AlexanderK22 commented 2 years ago

I'm trying to connect to our SAP system but when I do I get the error: Failed to connect to SYS:Cannot set headers after they are sent to the client.

I assume this is related to being behind a corporate proxy with a self signed certificate.

marcellourbani commented 2 years ago

Hi Alexander That's probably the case, this doesn't really support proxies

Will try to fix it, I already planned to integrate the standard vscode proxy support

Regards Marcello

AlexanderK22 commented 2 years ago

Hi Marcello,

Thanks for the quick response.

Looking forward to a fix and I'll be checking out if there is a way without having to go through the proxy.

Best regards Alexander

dsdaraujo commented 1 year ago

Hello guys, I have also been struggling with this issue for a while, and have just found out how to fix it. You have to change VSCode settings, setting Proxy Support to "off" (see below). Afterwards, configure "http_proxy" and "https_proxy" environment variables for your user (all lower case) with the url, port, username and password for the proxy (http://username:password@url:port). Important: https_proxy has also url with HTTP, and not HTTPS. Also, environment variable "no_proxy", to bypass proxy for local domains (localhost,127.0.0.1,*.yourdomain.com). image image

marcellourbani commented 1 year ago

Thanks for this! I should really look into it

lhemkendreis commented 1 year ago

I would love to find a solution to this!

My SAP System is behind a Proxy and when I try to connect, get this Error: Failed to connect to E31:AxiosError: Request failed with status code 403

When I set the proxy url (including my login details), as the "HTTP: Proxy" setting in VSCode, then I get the error mentioned by @AlexanderK22: Failed to connect to SYS:Cannot set headers after they are sent to the client.

I tried to use the solution mentioned by @dsdaraujo, but it did not work for me. I just went back to Error 403.

marcellourbani commented 1 year ago

@dsdaraujo @lhemkendreis I was about to code it tonight when I found out it's built in vscode! @AlexanderK22 this might fix your issue too perhaps with http.proxyAuthorization, or maybe not...

This will go in the README at next commit :

Proxy support

There's no direct support for proxies in the application, but you can use the builtin proxy in vscode, just use the option 'Use the proxy support for extensions.' If you only want to do it for a single system you can do it in its workspace (and save it, which is a good idea anyway)

image

{
  "http.proxySupport": "on",
  "http.proxy": "http://localhost:3128"
}