On Thursday 22 June 2017 at 20:23:28, Umar Draz wrote:

> This http check really something strange for me
> 
> look at that
> 
> curl -I https://www.secureteen.com/
> HTTP/1.1 200 OK
> Server: nginx
> Date: Thu, 22 Jun 2017 18:16:47 GMT
> Content-Type: text/html; charset=UTF-8
> 
> But here is icinga2 service output
> 
> HTTP OK: HTTP/1.1 301 Moved Permanently - 386 bytes in 0.256 second
> response time
> 
> Why?

It depends on what you put into your service check.

I tried:

object Host "mysite" {
   address = "www.secureteen.com"
   check_command = "http"
   vars.http_vhosts["www.secureteen.com"] = {
      http_uri = "/"
      http_ssl = "true"
   }
}

And the result I get is:
HTTP OK: HTTP/1.​1 302 Moved Temporarily - 64681 bytes in 0.​977 second 
response time

If instead I use:

object Host "mysite" {
   address = "www.secureteen.com"
   check_command = "http"
   vars.http_vhosts["www.secureteen.com"] = {
      http_uri = "https://www.secureteen.com/";
      http_ssl = "true"
   }
}

I get:
HTTP OK: HTTP/1.​1 200 OK - 27986 bytes in 0.​783 second response time

Why?

Because that website is hosted on a server hosting more than one website, and 
if the URL you request is simply "/" you get a response from the "main" web 
server.

If instead the URL you request is "www.secureteen.com/", you get the website 
you expected.

Here's a way for you to see the difference for yourself:

1. Look up the IP address of www.secureteen.com

2. Put that IP address into a browser as https://66.160.172.135/

You get redirected to https://cp.secureteen.com/login.php - that's the 302 
response above.

3. Now put https://www.secureteen.com/ into the browser and see the different 
result.

If you  wonder why giving the IP address or the website names into a browser 
makes a difference, you need to read about how HTTPS works, and how virtual 
hosting works.


Hope that helps,


Antony.

-- 
Python is executable pseudocode.
Perl is executable line noise.

                                                   Please reply to the list;
                                                         please *don't* CC me.
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to