Reputation: 9
I have a Django application deployed with Krakend gateway. All endpoints are active. But the service is unable to access the request data.
I'm giving the request as below
curl --location 'https://backend-dev-url.com/api/v1' \
--header 'Content-Type: application/json' \
--data '{
"a":"value",
"b":"value"
}'
This is the response that i get
{
"a": [
"This field is required."
],
"b": [
"This field is required."
]
}
I'm passing all the missing variables correctly. But somehow it is not reaching the service. It works perfectly on localhost. The issue is only with the deployed instance.
Below is the krakend configuration part for this microservice
{
"endpoint": "api/v1",
"method": "POST",
"output_encoding": "no-op",
"backend": [
{
"url_pattern": "api/v1",
"encoding": "no-op",
"sd": "static",
"method": "POST",
"host": ["http://localhost:8000"],
"disable_host_sanitize": false
}
],
"input_headers": ["Authorization","Content-Type"],
"extra_config": {
"qos/ratelimit/router": {
"max_rate": 100,
"client_max_rate": 60,
"every": "1m",
"strategy": "ip"
}
}
}
Thanks.
Upvotes: 0
Views: 64
Reputation: 1440
The gateway does not manipulate or filter the payload unless you add a component that does it, so if you send --data
it reaches the service as it is. The problem lies somewhere else.
I see some inconsistencies in the configuration you have passed.
curl
calls an endpoint /api
, but your configuration declares /api/v1
. So either you pasted here the wrong configuration or the request won't reach the place you expectlocalhost:8000
. If you use different machines or Docker containers, you must update this host to the correct one.Upvotes: 0