bjowes / cypress-ntlm-auth

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

Troubleshoot 504 issue #87

Closed bjowes closed 4 years ago

bjowes commented 4 years ago

i have same 504 issue i have set "cypress-ntlm": "set NODE_TLS_REJECT_UNAUTHORIZED=0 && npm run ntlm-proxy && (cypress-ntlm open & ntlm-proxy-exit)",

We received this error at the network level:

  > Error: Error establishing proxy connection. Response from server was: HTTP/1.1 504 Unknown Host
Date: Fri, 15 Nov 2019 14:32:04 GMT
Via: 1.1 proxy.localdomain
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Content-Length: 666

Originally posted by @spham in https://github.com/bjowes/cypress-ntlm-auth/issues/68#issuecomment-554381829

bjowes commented 4 years ago

I would need some more information to help out with the troubleshooting.

  1. Please provide
    • Cypress version:
    • cypress-ntlm-auth version:
    • OS:
  2. Can you connect to the site without the plugin?
  3. In your error log the address proxy.localdomain is listed. Is this an actual host in your environment?
spham commented 4 years ago

hi here some information

  1. config

    • cypress 3 6 1
    • cypress-ntlm-auth 2 0 3
    • os : windows 7
  2. i can connect to remote site outside , but behind corporates proxy. no with cypress and plugin

  3. i dont know what is proxy.localdomain, the host name start with https://eeeee.local.com/xxx

bjowes commented 4 years ago

Hmm, you say you are behind a corporate proxy but the site address looks very local to me. That could be the case, but what interests me is if you need to cross the corporate proxy to access your site (or resources used by your site). If this is the case, you need to ensure that config for the corporate proxy is passed to the plugin. This is documented in the readme under Upstream proxy, but in short you should set the environment variable HTTP_PROXY to the url to your corporate proxy before starting ntlm-proxy.

If this is not the case, could you please provide debug logs from the plugin?

spham commented 4 years ago

i try to connect to host in intranet. i dont get how to setup proxy for internal host

bjowes commented 4 years ago

On local Intranet you won’t pass through the corporate proxy, so you should be able to reach the site without it. Could you provide the debug logs then?

spham commented 4 years ago

ok i will send log monday when come back to office. but for my issue. before i have 501. it mean server not autorize access. i will try ntmlSso

bjowes commented 4 years ago

Hey @spham - any update on this?

spham commented 4 years ago

hi we close. because switch on jest/puppeteer

spham commented 4 years ago

hi i have more time now

> set DEBUG=cypress:plugin:ntlm-auth & start /min "ntlm-proxy" cmd /c node_modules\.bin\ntlm-proxy

 ←[0mGET /__/ ←[32m200 ←[0m11.181 ms - -←[0m
←[0mGET /__cypress/runner/cypress_runner.css ←[32m200 ←[0m8.801 ms - -←[0m
←[0mGET /__cypress/runner/cypress_runner.js ←[32m200 ←[0m8.647 ms - -←[0m
←[0mGET /__cypress/static/favicon.ico ←[32m200 ←[0m1.379 ms - -←[0m
←[0mGET /__cypress/iframes/integration/plv_spec.js ←[32m200 ←[0m2.778 ms - 735←[0m
←[0mGET /__cypress/runner/fonts/fa-solid-900.woff2 ←[32m200 ←[0m1.256 ms - 75728←[0m
←[0mGET /__cypress/tests?p=cypress%5Cintegration%5Cplv_spec.js-512 ←[32m200 ←[0m1023.829 ms - -←[0m
←[0mGET /__cypress/tests?p=cypress%5Csupport%5Cindex.js-687 ←[32m200 ←[0m1571.415 ms - -←[0m
←[0mHEAD / ←[31m504 ←[0m2592.944 ms - -←[0m
←[0mHEAD / ←[31m504 ←[0m2618.124 ms - -←[0m
←[0mHEAD / ←[31m504 ←[0m5179.971 ms - -←[0m
bjowes commented 4 years ago

Hi @spham ,

The log that you sent is from the cypress command window. ntlm-proxy is started in a separate console window, could you paste the log from that window instead? Also, some users had issues when setting the DEBUG variable on the same line as starting the ntlm-proxy (like in your paste above). Try doing the set DEBUG... before starting cypress-ntlm.

Also, please update to the latest version of the plugin (and why not cypress too)