Cyclenerd / static_status

🚦Bash script to generate a static status page.
https://cyclenerd.github.io/static_status/
GNU General Public License v3.0
536 stars 71 forks source link

Bug: http-status not working #50

Closed Yanncha closed 2 years ago

Yanncha commented 2 years ago

Hello all !

First, thanks to all contributors for this simple yet useful script, I was looking for exactly this kind of soft.

I have trouble having http-status command to work, with the following lines in the hosts list : http-status;http://localhost;200 http-status;http://www.google.fr;200

If I do a curl -I on these addresses, the 1st line is as expected : HTTP/1.1 200 OK Am I missing something ? I tried both on an Apache webserver (with config lines above) and on my laptop, replacing localhost with the webserver address, and the result is the same. I'm using I think the latest script version from commit dfa2280f6808302a711a51a9108247409520fc64

Thanks in advance for your help. Yc

Cyclenerd commented 2 years ago

Hi,

It works for me. I will also add it to the automatic test.

I put this to the hostname list:

http-status;https://www.heise.de;200

The curl command is then:

curl "$MY_CURL_PARAMETERS" -s -o /dev/null -I --max-time "$MY_TIMEOUT" -w "%{http_code}" "$MY_HOSTNAME" 2>/dev/null

Example:

curl -s -o /dev/null -I --max-time "30" -w "%{http_code}" "https://www.heise.de/ping" 2>/dev/null

google.fr:

$ curl -s -o /dev/null -I --max-time "30" -w "%{http_code}" "http://www.google.fr" 2>/dev/null
200

What error do you get with the curl commands?

Yanncha commented 2 years ago

Hi ! Thanks for your quick answer.

If I add http-status;https://www.heise.de;200 to the hostname list, it fails as well with a DOWN.

If I enter the curl commands you sent me, it works (for both) : no error is displayed, and 200 appears in the console after the command.

Cyclenerd commented 2 years ago

I believe I have found the error. I'll publish a fix in a moment.

Cyclenerd commented 2 years ago

The error was the parameter MY_CURL_PARAMETERS implemented with commit https://github.com/Cyclenerd/static_status/commit/7d5d4745b78364fa447a8f4cc2a841d235397b12.

I have removed that now with commit https://github.com/Cyclenerd/static_status/commit/e335e91472263df3d8c65f9dd6d56915666d5139. curl parameters can be better passed with the .curlrc config file.

FYI @e-minguez: configure -k (insecure) now with curlrc please.

Yanncha commented 2 years ago

Thanks ! I tried on my side with your fix, it works fine (with above cases).

Cyclenerd commented 2 years ago

Happy to hear that. Thank you for finding the error.

Yanncha commented 2 years ago

Glad to (modeslty) help ! :)