Icinga2 http service and 502 bad gateway error

I have a configuration as below. But I m getting 502 gateway error. When I check this with curl from the server, I see 200. But I am getting 502 error by Icinga. How should I fix this issue?

object Service "HTTPS Service" {
  import "generic-service"
  check_command = "http"
  vars.http_address = "rest.example.com"
  vars.http_vhost = "rest.example.com"
  vars.http_ssl = true

  host_name = "rest.example.com"
  vars.http_vhosts["rest.example.com"] = {
    http_uri = "/v4/logs/"
  }
  command_endpoint = "rest.example.com"
}