Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 response code on any endpoint - how to monitor it? #520

Closed
setevoy2 opened this issue Jun 15, 2020 · 3 comments · Fixed by #525
Closed

404 response code on any endpoint - how to monitor it? #520

setevoy2 opened this issue Jun 15, 2020 · 3 comments · Fixed by #525

Comments

@setevoy2
Copy link

Hi, thanks for the tool!

Faced with an issue: adding the service to our monitoring, and found that every endpoint responses with the 404:

$ curl -I http://push.example.com/
HTTP/1.1 404 Not Found
$ curl -I http://push.example.com/healthz
HTTP/1.1 404 Not Found
$ curl -I http://push.example.com/api/config
HTTP/1.1 404 Not Found
$ curl -I http://push.example.com/api/stats/go
HTTP/1.1 404 Not Found

What the correct way to run the checks then?

@slimus
Copy link
Contributor

slimus commented Jun 15, 2020

Hi @setevoy2 ! Can you please show your config?
I ran with default config and these locations returned 200 OK :
http://localhost:8088/version
{ source: "https://github.com/appleboy/gorush", version: "v1.11.2-61-g6bad479" }
http://localhost:8088/
{ text: "Welcome to notification server." }

Which version are you using?

@yaronius
Copy link
Contributor

yaronius commented Jun 22, 2020

@slimus I reproduced the issue with Postman when using HEAD method, probably this is the issue. Gorush should handle HEAD at least for some endpoints, as this is often used by various monitoring tools. Actually, all what is needed is a line in server.go:

r.HEAD(PushConf.API.HealthURI, heartbeatHandler)

@appleboy
Copy link
Owner

curl default method is GET

$ curl -v http://localhost:8088/healthz
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8088 (#0)
> GET /healthz HTTP/1.1
> Host: localhost:8088
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Gorush-Version: v1.12.0-25-g50bb20a
< Date: Tue, 23 Jun 2020 03:16:06 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact

curl -I for HEAD

$ curl -v -I http://localhost:8088/healthz
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8088 (#0)
> HEAD /healthz HTTP/1.1
> Host: localhost:8088
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
HTTP/1.1 404 Not Found
< Content-Type: text/plain
Content-Type: text/plain
< X-Gorush-Version: v1.12.0-25-g50bb20a
X-Gorush-Version: v1.12.0-25-g50bb20a
< Date: Tue, 23 Jun 2020 03:16:55 GMT
Date: Tue, 23 Jun 2020 03:16:55 GMT
< Content-Length: 18
Content-Length: 18

<
* Connection #0 to host localhost left intact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants