github.com/avenga/couper@v1.12.2/server/testdata/integration/config/14_couper.hcl (about)

     1  server {
     2    endpoint "/unknown" {
     3      response {
     4        json_body = backends.UNKNOWN.health
     5      }
     6    }
     7    endpoint "/healthy/default" {
     8      response {
     9        json_body = backends.healthy.health
    10      }
    11    }
    12    endpoint "/healthy/expected_status" {
    13      response {
    14        json_body = backends.healthy_expected_status.health
    15      }
    16    }
    17    endpoint "/healthy/expected_text" {
    18      response {
    19        json_body = backends.healthy_expected_text.health
    20      }
    21    }
    22    endpoint "/healthy/path" {
    23      response {
    24        json_body = backends.healthy_path.health
    25      }
    26    }
    27    endpoint "/healthy/headers" {
    28      response {
    29        json_body = backends.healthy_headers.health
    30      }
    31    }
    32    endpoint "/healthy/ua-header" {
    33      response {
    34        json_body = backends.healthy_ua_header.health
    35      }
    36    }
    37    endpoint "/healthy/no_follow_redirect" {
    38      response {
    39        json_body = backends.healthy_no_follow_redirect.health
    40      }
    41    }
    42    endpoint "/unhealthy/timeout" {
    43      response {
    44        json_body = backends.unhealthy_timeout.health
    45      }
    46    }
    47    endpoint "/unhealthy/bad_status" {
    48      response {
    49        json_body = backends.unhealthy_bad_status.health
    50      }
    51    }
    52    endpoint "/unhealthy/bad_expected_status" {
    53      response {
    54        json_body = backends.unhealthy_bad_expected_status.health
    55      }
    56    }
    57    endpoint "/unhealthy/bad_expected_text" {
    58      response {
    59        json_body = backends.unhealthy_bad_expected_text.health
    60      }
    61    }
    62    endpoint "/unhealthy/bad_path" {
    63      response {
    64        json_body = backends.unhealthy_bad_path.health
    65      }
    66    }
    67    endpoint "/unhealthy/headers" {
    68      response {
    69        json_body = backends.unhealthy_headers.health
    70      }
    71    }
    72    endpoint "/unhealthy/no_follow_redirect" {
    73      response {
    74        json_body = backends.unhealthy_no_follow_redirect.health
    75      }
    76    }
    77    endpoint "/failing" {
    78      response {
    79        json_body = backends.failing.health
    80      }
    81    }
    82  
    83    endpoint "/dummy" {
    84      request "default" {
    85        backend = "healthy"
    86      }
    87      request "healthy_expected_status" {
    88        backend = "healthy_expected_status"
    89      }
    90      request "healthy_expected_text" {
    91        backend = "healthy_expected_text"
    92      }
    93      request "healthy_path" {
    94        backend = "healthy_path"
    95      }
    96      request "healthy_headers" {
    97        backend = "healthy_headers"
    98      }
    99      request "healthy_ua_header" {
   100        backend = "healthy_ua_header"
   101      }
   102      request "healthy_no_follow_redirect" {
   103        backend = "healthy_no_follow_redirect"
   104      }
   105      request "unhealthy_timeout" {
   106        backend = "unhealthy_timeout"
   107      }
   108      request "unhealthy_bad_status" {
   109        backend = "unhealthy_bad_status"
   110      }
   111      request "unhealthy_bad_expected_status" {
   112        backend = "unhealthy_bad_expected_status"
   113      }
   114      request "unhealthy_bad_expected_text" {
   115        backend = "unhealthy_bad_expected_text"
   116      }
   117      request "unhealthy_bad_path" {
   118        backend = "unhealthy_bad_path"
   119      }
   120      request "unhealthy_headers" {
   121        backend = "unhealthy_headers"
   122      }
   123      request "unhealthy_no_follow_redirect" {
   124        backend = "unhealthy_no_follow_redirect"
   125      }
   126      request "failing" {
   127        backend = "failing"
   128      }
   129    }
   130  }
   131  
   132  definitions {
   133    backend "healthy" {
   134      origin = "${env.COUPER_TEST_BACKEND_ADDR}/health"
   135      beta_health {}
   136    }
   137    backend "healthy_expected_status" {
   138      origin = "${env.COUPER_TEST_BACKEND_ADDR}/not-there"
   139      beta_health {
   140        expected_status = [404]
   141      }
   142    }
   143    backend "healthy_expected_text" {
   144      origin = "${env.COUPER_TEST_BACKEND_ADDR}/health"
   145      beta_health {
   146        expected_text = "👍"
   147      }
   148    }
   149    backend "healthy_path" {
   150      origin = env.COUPER_TEST_BACKEND_ADDR
   151      beta_health {
   152        path = "/anything?foo=bar"
   153        expected_text = "\"RawQuery\":\"foo=bar\""
   154      }
   155    }
   156  
   157    backend "healthy_headers" {
   158      origin = env.COUPER_TEST_BACKEND_ADDR
   159      beta_health {
   160        path = "/anything"
   161        headers = {User-Agent: "Couper-Health-Check"}
   162        expected_text = "\"UserAgent\":\"Couper-Health-Check\""
   163      }
   164    }
   165  
   166    backend "healthy_ua_header" {
   167      origin = env.COUPER_TEST_BACKEND_ADDR
   168      beta_health {
   169        path = "/anything"
   170        expected_text = "\"UserAgent\":\"Couper / 0 health-check\""
   171      }
   172    }
   173  
   174    backend "healthy_no_follow_redirect" {
   175      origin = env.COUPER_TEST_BACKEND_ADDR
   176      beta_health {
   177        path = "/redirect?url=/health?redirected"
   178        expected_status = [302]
   179      }
   180    }
   181    backend "unhealthy_timeout" {
   182      origin = "http://1.2.3.4"
   183      beta_health {
   184        failure_threshold = 0
   185        interval = "250ms"
   186      }
   187    }
   188    backend "unhealthy_bad_status" {
   189      origin = "${env.COUPER_TEST_BACKEND_ADDR}"
   190      beta_health {}
   191    }
   192    backend "unhealthy_bad_expected_status" {
   193      origin = "${env.COUPER_TEST_BACKEND_ADDR}/health"
   194      beta_health {
   195        expected_status = [500]
   196      }
   197    }
   198    backend "unhealthy_bad_expected_text" {
   199      origin = "${env.COUPER_TEST_BACKEND_ADDR}/health"
   200      beta_health {
   201        expected_text = "down?"
   202      }
   203    }
   204    backend "unhealthy_bad_path" {
   205      origin = "${env.COUPER_TEST_BACKEND_ADDR}/health"
   206      beta_health {
   207        path = "/"
   208      }
   209    }
   210    backend "unhealthy_headers" {
   211      origin = "${env.COUPER_TEST_BACKEND_ADDR}/anything"
   212      beta_health {
   213        headers = {User-Agent = "FAIL"}
   214        expected_text = "Go-http-client"
   215      }
   216    }
   217    backend "unhealthy_no_follow_redirect" {
   218      origin = env.COUPER_TEST_BACKEND_ADDR
   219      beta_health {
   220        path = "/redirect?url=/health?redirected"
   221        expected_text = "👍"
   222      }
   223    }
   224    backend "failing" {
   225      origin = "http://1.2.3.4"
   226      beta_health {
   227        failure_threshold = 10
   228        interval = "250ms"
   229      }
   230    }
   231  }
   232  
   233  settings {
   234    no_proxy_from_env = true
   235  }