jeffbski / jeffbski/wait-on

wait-on claims endpoint is returning 404, when it's actually returning 200.

Open
#78 13 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
87
PR merge metrics
No merged PRs in 30d

Description

I have a webpack-dev-server running in HTTPS mode:

```
cross-env ./node_modules/.bin/webpack-dev-server --config webpack.ci.config.js --progress --inline --port 8080 --host 0.0.0.0 --public localhost:8080 --content-base src/
```

`wait-on` will correctly tell me the URL is up with no path:

```
npm-run wait-on https://127.0.0.1:8080/
```

passes no problem, but it fails for /login:

```sh
$npm-run wait-on -v https-get://127.0.0.1:8080/login
waiting for 1 resources: https-get://127.0.0.1:8080/login
making HTTP(S) get request to url:https://127.0.0.1:8080/login ...
HTTP(S) error for https://127.0.0.1:8080/login Error: Request failed with status code 404
making HTTP(S) get request to url:https://127.0.0.1:8080/login ...
HTTP(S) error for https://127.0.0.1:8080/login Error: Request failed with status code 404
```

But curl gets a 200 OK:

```sh
$ curl -v -k https://127.0.0.1:8080/login > /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:

-- 8< -- cut out lots of boring SSL stuff here -- >8 --

> GET /login HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Accept-Ranges: bytes
< Cache-Control: public, max-age=0
< Last-Modified: Sat, 22 Aug 2020 03:58:59 GMT
< ETag: W/"4654-1741451ce07"
< Content-Type: text/html; charset=UTF-8
< Content-Length: 18004
< Date: Sat, 22 Aug 2020 04:00:41 GMT
< Connection: keep-alive
<
{ [11512 bytes data]
100 18004 100 18004 0 0 502k 0 --:--:-- --:--:-- --:--:-- 502k
* Connection #0 to host 127.0.0.1 left intact
* Closing connection 0
```

And `cross-fetch` finds it fine, too:

```sh
$ NODE_TLS_REJECT_UNAUTHORIZED=0 node
Welcome to Node.js v12.18.3.
Type ".help" for more information.
> const fetch = require('cross-fetch')
undefined
> fetch('https://127.0.0.1:8080/login').then(res => console.log(res.status))
Promise { }
> (node:91717) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
200
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.