bjowes / cypress-ntlm-auth

Windows authentication plugin for Cypress
MIT License
54 stars 9 forks source link

Correct proxy settings #250

Closed EEO27 closed 3 months ago

EEO27 commented 3 months ago

This is the third time I need your help, every time I get a little closer. At this point I see the following Proxy settings and results in Cypress:

With ntlm-auth-plugin

Proxy server: http://127.0.0.1:58505 Proxy bypass list: <-loopback>

Result: Intranet: Available. Internet not available (google.com and acc-webaplication.nl) API request with NTLM auth are working on O-Domain & A-Domain (connection with backand = OK) ################################################

Without ntlm-auth-plugin

Proxy server: http://proxy.o-xxx.xxx.nl:8080/ Proxy bypass list: 127.0.0.1,::1,localhost

Result: Intranet: Not available Internet: Available (google.com and acc-webaplication.nl) API Request with NTLM auth: Not working, this is as expected, because the NTLM-Auth is not running ################################################

Recap: When I run Cypress+ntlm-auth-plugin the proxy settings are changing in a way where I cant connect to the internet. So I cant load the frontend of the ACC environment (different domain). But the API request to the ACC-backend with the NTLM authorisation is working perfectly.

How could I achieve connection with the internet while I run Cypress +ntlm-plugin? How does the <-loopback> work? Should exclude anything on it? Do you have anysuggestion for this situation?

And in .npmrc I have the following: registry=https://nexus.o-xxx.xxx.nl/repository/npm-all strict-ssl=false

I have proxysettings on my pc like this: image

Logs when try to connect google.com cypress:plugin:ntlm-auth Tunnel to www.google.com:443 +2s cypress:plugin:ntlm-auth Got unexpected error on PROXY_TO_SERVER_SOCKET. Target: content-autofill.googleapis.com:443 AggregateError at internalConnectMultiple (node:net:1114:18) at afterConnectMultiple (node:net:1667:5) { code: 'ETIMEDOUT',

Error: connect ETIMEDOUT 216.58.214.10:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '216.58.214.10',
  port: 443
},
Error: connect ETIMEDOUT 142.250.179.138:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '142.250.179.138',
  port: 443
},
Error: connect ETIMEDOUT 142.251.36.42:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '142.251.36.42',
  port: 443
},
Error: connect ETIMEDOUT 142.250.179.170:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '142.250.179.170',
  port: 443
},
Error: connect ETIMEDOUT 142.250.179.202:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '142.250.179.202',
  port: 443
},
Error: connect ETIMEDOUT 142.251.36.10:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '142.251.36.10',
  port: 443
},
Error: connect ETIMEDOUT 142.251.39.106:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '142.251.39.106',
  port: 443
},
Error: connect ETIMEDOUT 172.217.23.202:443
    at createConnectionError (node:net:1634:14)
    at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '172.217.23.202',
  port: 443
},
Error: connect ETIMEDOUT 216.58.208.106:443
    at createConnectionError (node:net:1634:14)
    at afterConnectMultiple (node:net:1664:40) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '216.58.208.106',
  port: 443
}

]

bjowes commented 3 months ago

Could you try again with the beta version I prepared earlier? If it doesn't work, please set the environment variable HTTP_PROXY to the proxy server you see in cypress when running without the plugin (http://proxy.o-xxx.xxx.nl:8080/). Remove the trailing slash on the proxy URL, I'm not sure at the moment if that might cause issues.

EEO27 commented 3 months ago

Hello!

I can confirm that I finaly found a differend proxy that have worked for me. I found that there was an another proxy which I have to use to acces the internet. It was http://**proxys**.xxx.xxx.nl:8080/)

The results are as folowing:

set HTTP_PROXY=http://proxys.xxx.xxx.nl:8080 && npx cypress-ntlm run --> Perfectly working in CLI image

set HTTP_PROXY=http://proxys.xxx.xxx.nl:8080 && npx cypress-ntlm run --headed --> Perfectly working in CLI & headed! image

set HTTP_PROXY=http://proxys.xxx.xxx.nl:8080 && npx cypress-ntlm open --> Endless loading Cypress interface image

So there is a different behaviour between npx cypress-ntlm open and npx cypress-ntlm run --headed But for now, it is working perfectly. thank you for your plugin and support!!

bjowes commented 3 months ago

Great news! It is wierd that the open command behaves differently. The code in the plugin is close to identical in the two cases, so I'm wondering if there might be something in cypress itself that behaves differently on open.

I experimented a bit and found:

Apparently cypress itself is doing something proxy unfriendly at startup. Likely it is checking for updates or connecting to the cloud service.

bjowes commented 2 months ago

@EEO27 - The root cause for npx cypress-ntlm open stalling (without extra arguments) should be resolved with Cypress 13.9.0 after they merged my PR.

EEO27 commented 2 months ago

This sounds perfect!

Op wo 8 mei 2024 om 18:29 schreef Björn Weström @.***>:

@EEO27 https://github.com/EEO27 - The root cause for npx cypress-ntlm open stalling (without extra arguments) should be resolved with Cypress 13.9.0 after they merged my PR.

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/250#issuecomment-2100959831, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4GAZOPNG7QS2H5XM2TBDSDZBJHIJAVCNFSM6AAAAABFICI6QGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBQHE2TSOBTGE . You are receiving this because you were mentioned.Message ID: @.***>