keiWork
February 21, 2023, 6:41am
1
I use proxy when connecting to https such as https://example.com/ .
At this time, the proxy server needs to be connected to with the “CONNECT method”, but this is not in the ‘Request Method’ setting of the http request node.
For https, the log on the proxy server (squid) side will look like the following when using a browser or the curl command.
Method: CONNECT
2023-02-21 02:53:22.861 XXX 10.10.X.XXX TCP_TUNNEL/200 XXXX CONNECT www.example.com:443 - HIER_DIRECT/www.example.com -
However, the logs via n8n were as follows.
Method: GET
2023-02-20 13:06:37.120 XXX 10.10.XX.XXX TCP_MISS/503 XXXX GET https://www.example.com/ - HIER_DIRECT/www.example.com text/html
Therefore, it is necessary to explicitly configure the connection with the CONNECT method.
This is a problem with the underlying axios library… very painful
opened 06:31PM - 16 Mar 22 UTC
#### Describe the bug
Using Axios 0.26.1 behind a corporate HTTP tunneling prox… y to an HTTPS destination, once the proxy connection is made, a POST method is issued, rather than a CONNECT to establish the TLS tunnel to the destination host where the POST should be sent. Result is **Error: socket hang up**, as the proxy expects a CONNECT to be issued and drops the connection
Specifically, using wireshark to monitor the activity of the script goes as follow:
> TCP SYN
< TCP SYN, ACK
> TCP ACK
> HTTP POST
< TCP FIN, ACK
> TCP ACK
![axios_pcap](https://user-images.githubusercontent.com/15218042/158659772-3d084e3b-8ab1-4f99-8c4d-0a54ed697ed4.png)
If you use curl with the same environment, the packets are as follows:
> TCP SYN
< TCP SYN, ACK
> TCP ACK
> HTTP CONNECT
< HTTP Connection established
> TCP ACK
> TLS Client Hello
< TLS Server Hello
... encrypted POST and response follows
![curl_pcap](https://user-images.githubusercontent.com/15218042/158659774-5c84d76a-3370-4acb-9a5d-f9270de12bf7.png)
#### To Reproduce
```bash
export http_proxy="http://user:[email protected] :80"
export https_proxy="http://user:[email protected] :80"
```
```js
http.post('https://api.github.com/user/repos', {});
```
#### Expected behavior
When connecting to an HTTPS server through a tunneling HTTP proxy, the CONNECT method should be used to establish the TLS handshake before issuing the POST
#### Environment
- Axios Version 0.26.1
- Adapter HTTP
- Node.js Version 14.8.0
- OS: Windows 10 (10.0.19042.1526)
opened 04:28AM - 05 Nov 20 UTC
closed 05:34PM - 12 Jun 22 UTC
<!-- Click "Preview" for a more readable version --
Please read and follow th… e instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
HTTPS over HTTP Proxy Fails with 500 handshakefailed on mcafee proxy.
`mcafee initialize server context:handshakefailed:server state 1:state 9:Application response 500 handshakefailed`
With HTTP_PROXY and HTTPS_PROXY set, curl works but axios.get fails.
#### To Reproduce
```ts
import axios from 'axios';
(async () => {
try {
console.log(await axios.get('https://github.com/'));
} catch (e) {
console.log(e);
}
})();
```
#### Expected behavior
Request should succeed.
#### Environment
- Axios Version [0.21.0]
- Node.js Version [v12.18.3]
- OS: [OSX 10.15.7]
#### Additional context/Screenshots
N/A
#### Current workaround
Install `global-agent`, remove the HTTP_PROXY env vars and set GLOBAL_AGENT_HTTP_PROXY.
Add `import 'global-agent/bootstrap';` to index.
1 Like
keiWork
February 27, 2023, 9:27am
3
Thank you for your answer!
It seems difficult to solve the problem as you said it is not an n8n issue.
Hopefully this will be fixed in axios.
It is sad that we have the http request node, but we will create it ourselves with Execute Command.
I have this issue.
It seems a workkaround has been found with tunnel-agent
opened 04:28AM - 05 Nov 20 UTC
closed 05:34PM - 12 Jun 22 UTC
<!-- Click "Preview" for a more readable version --
Please read and follow th… e instructions before submitting an issue:
- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
-->
#### Describe the bug
HTTPS over HTTP Proxy Fails with 500 handshakefailed on mcafee proxy.
`mcafee initialize server context:handshakefailed:server state 1:state 9:Application response 500 handshakefailed`
With HTTP_PROXY and HTTPS_PROXY set, curl works but axios.get fails.
#### To Reproduce
```ts
import axios from 'axios';
(async () => {
try {
console.log(await axios.get('https://github.com/'));
} catch (e) {
console.log(e);
}
})();
```
#### Expected behavior
Request should succeed.
#### Environment
- Axios Version [0.21.0]
- Node.js Version [v12.18.3]
- OS: [OSX 10.15.7]
#### Additional context/Screenshots
N/A
#### Current workaround
Install `global-agent`, remove the HTTP_PROXY env vars and set GLOBAL_AGENT_HTTP_PROXY.
Add `import 'global-agent/bootstrap';` to index.
I don’t now how to test in n8n
1 Like
Hi,
I just saw that 1.22.0 included an updated version of Axios from 0.21.4 to 1.6.2.
I tested on 1.22.3, the issue is always present