Closed sebgamby closed 1 year ago
Hi @sebgamby, This is already possible. Please see the Advanced startup section in the readme. You can set two environment variables to control the ports used by ntlm-proxy, start the ntlm-proxy and then start cypress-ntlm. It will then use the existing ntlm-proxy instead of starting its own. Remember to shut down the ntlm-proxy when done so your machine doesn't get swarmed with ntlm-proxy instances over time.
I was already aware of those environment variables. I have made a test with the following in a Powershell prompt on Windows 10: $env:CYPRESS_NTLM_AUTH_API="http://127.0.0.1:57614" $env:CYPRESS_NTLM_AUTH_PROXY="http://127.0.0.1:57615" $env:NO_PROXY="<-loopback>,localhost:1080,localhost:1025,localhost:44328,localhost:57614,localhost:57615" Then I execute "npx cypress-ntlm open" and I get "An error occurred while communicating with NTLM proxy: connect ECONNREFUSED 127.0.0.1:61805"
Now I execute "npx ntlm-proxy" in a separate Powershell prompt, write-down the reserved ports, go back to the initial prompt, adapt the variables based on written down values, and re-run "npx cypress-nltm" then it works this time.
My issue is that I cannot instruct ntlm-proxy to use specific ports. I have tried setting the environment variables CYPRESS_NTLM_AUTH_API and CYPRESS_NTLM_AUTH_PROXY in its dedicated Powershell prompt but they are ignored and on each new execution, new ports are reserved. I would need ntlm-proxy to reserve the ports I have selected instead of random ones.
Ok, thanks for clarifying. Indeed the ntlm-proxy should respect those environment variables. I'll investigate.
On Tue, Sep 6, 2022 at 12:12 PM sebgamby @.***> wrote:
I was already aware of those environment variables. I have made a test with the following in a Powershell prompt on Windows 10: $env:CYPRESS_NTLM_AUTH_API="http://127.0.0.1:57614" $env:CYPRESS_NTLM_AUTH_PROXY="http://127.0.0.1:57615"
$env:NO_PROXY="<-loopback>,localhost:1080,localhost:1025,localhost:44328,localhost:57614,localhost:57615" Then I execute "npx cypress-ntlm open" and I get "An error occurred while communicating with NTLM proxy: connect ECONNREFUSED 127.0.0.1:61805"
Now I execute "npx ntlm-proxy" in a separate Powershell prompt, write-down the reserved ports, go back to the initial prompt, adapt the variables based on written down values, and re-run "npx cypress-nltm" then it works this time.
My issue is that I cannot instruct ntlm-proxy to use specific ports. I have tried setting the environment variables CYPRESS_NTLM_AUTH_API and CYPRESS_NTLM_AUTH_PROXY in its dedicated Powershell prompt but they are ignored and on each new execution, new ports are reserved. I would need ntlm-proxy to reserve the ports I have selected instead of random ones.
— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/208#issuecomment-1237948326, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3B5QNLLJ5CG7AEBW6DV44KJNANCNFSM6AAAAAAQFS2YMA . You are receiving this because you commented.Message ID: @.***>
Thanks in advance. For information, I am version 4.0.2 of cypress-ntlm-auth and version 9.4.1 of Cypress. Let me know if you need extra information.
Please try version 4.0.3
I have just tested and it works. Thank you for the very fast resolution.
Hello,
I have checked the issue history and I now that I am not the first one to request this but may I present my use case? I have a CI pipeline that runs only on Windows Server 2016 due to my company policy. I need to run everything on the same machine: the Web application under test, the backend used by this Web application, supporting tests services like maildev and of course the test code itself. It is working fine for the moment but I am trying to include OWASP ZAP in order to perform a passive scanning of the Web page during the execution of the Cypress tests. To get the Web traffic between the Cypress-controlled browser and the Web application to transit by ZAP, I must tweak the environment variables HTTP_PROXY and NO_PROXY. The value I use for NO_PROXY is "<-loopback>,localhost:1080,localhost:1025,localhost:44328" which forces the localhost traffic to transit by the ZAP proxy except for the traffic to maildev and to the backend, as it raises errors. It works fine with Web applications that do not use Windows Authentication. For the Web applications that do use Windows Authentication, the routing of the traffic to the NTLM proxy through ZAP raises errors. If I could force this NTLM proxy to use specific ports then I could include them in the NO_PROXY and get the test running. Would it be possible to add such a feature?