-
Notifications
You must be signed in to change notification settings - Fork 470
Closed
Description
Describe the bug
I am trying to create an endpoint with static/stub data. When I use a yaml config file, the endpoint does not work.
➜ ~ ☞ curl -v http://localhost:8888/health
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8888 (#0)
> GET /health HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< X-Krakend: Version 1.1.0
< X-Krakend-Completed: false
< Date: Mon, 09 Mar 2020 01:08:43 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact
* Closing connection 0
[GIN] 2020/03/09 - 01:03:06 | 500 | 3.0527ms | 172.17.0.1 | GET /health
Error #01: Get "http://fake-backend/": dial tcp: lookup fake-backend on 192.168.65.1:53: no such host
However, if I use a json config file it works as expected. I mostly followed the example here: https://www.krakend.io/docs/endpoints/health/
I tried experimenting with output_encoding: string
and using a string in data: 'hello there'
with no success.
Your configuration file
{
"version": 2,
"port": 8888,
"endpoints": [
{
"endpoint": "/health",
"extra_config": {
"github.com/devopsfaith/krakend/proxy": {
"static": {
"data": {
"status": "OK"
},
"strategy": "always"
}
}
},
"backend": [
{
"url_pattern": "/",
"host": [
"http://fake-backend"
]
}
]
}
]
}
version: 2
port: 8888
endpoints:
- endpoint: "/health"
extra_config:
github.com/devopsfaith/krakend/proxy:
static:
data:
status: OK
strategy: always
backend:
- url_pattern: "/"
host:
- http://fake-backend
Commands used
How did you start the software?
docker run -p 8888:8888 -v "${PWD}:/etc/krakend/" devopsfaith/krakend run -d -c /etc/krakend/krakend.yaml
Expected behavior
A json config file should work the same as a yaml config file. I should be able to create a static proxy endpoint.
Thanks for your help and thanks for the amazing product, I really enjoy using KrakendD.