HI team, How I can enable post method for the API. Its working with get but not with post.
I tried below but still not working.
“proxy”: {
“listen_path”: “/CloudGateway/rest/”,
“target_url”: “https://ip-10-10-31-38.ap-southeast-1.compute.internal:8443/CloudGateway/rest/ ”,
“strip_listen_path”: false
“methods”: [“GET”, “POST”],
I am getting below error:
curl -X POST https://ec2-18-142-155-240.ap-southeast-1.compute.amazonaws.com:8080/CloudGateway/rest/ --insecure -u “cibadmin:admin”
“Unsupported endpoint:CloudGateway”
get is working fine.
Olu
October 11, 2021, 8:46am
3
Hi @saloni512 , could you try the call against your upstream? Tyk errors usually come in json format so it appears this is coming from your backend.
Olu
October 11, 2021, 9:22am
5
Could you share your full API definition? I can see a “methods” child property of “proxy” that does not exist in our docs .
Also, the gateway logs would be pretty useful.
HI Olu, I have resolved it. For the post request it was adding listen path to the target url so url forming was "POST /CloudGateway/rest/CloudGateway/rest/ and was throwing the error.
I have removed context from target url and its working like below:
“proxy”: {
“preserve_host_header”: false,
“listen_path”: “/CloudGateway/rest/”,
“target_url”: “https://ip-10-10-31-38.ap-southeast-1.compute.internal:8443 ”,
“disable_strip_slash”: false,
“strip_listen_path”: false,
“enable_load_balancing”: false,
“target_list”: null,
“check_host_against_uptime_tests”: false,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 0,
“endpoint_returns_list”: false
But just a small question If I want to enable different methods How I can enable. Can you Please suggest.
Olu
October 11, 2021, 10:16am
7
All methods are enabled by default. There is no special place to enable the HTTP methods, however, you can disable everything but a few methods or endpoints using whitelist . Example below
"extended_paths": {
"url_rewrites": [],
"track_endpoints": [],
"white_list": [
{
"path": "",
"ignore_case": false,
"method_actions": {
"POST": {
"action": "no_action",
"code": 200,
"headers": {}
}
}
}
]
}
Or you can simply blacklisting an endpoint or method if you chose instead. Implementing a blacklist on an endpoint works the same as whitelist. Hope this helps.