luraproject / lura

Ultra performant API Gateway with middlewares. A project hosted at The Linux Foundation
https://luraproject.org
Other
6.35k stars 564 forks source link

Inquire about the processing of one post request #346

Closed moonhj3117 closed 3 years ago

moonhj3117 commented 4 years ago

Hi During the test, there is a blockage, so leave a question.

After configuring with the following config When I make a POST request, I get a 404 error

[GIN] 2020/04/04 - 16:40:22 | 404 | 22.113µs | ::1 | POST /ldcc/v1/ai-recruiting/abnormal_keyword/LDCC100

If I try after setting with each backend, it works normally. If I make a mistake, please give me some advice.

{ "endpoint": "/ldcc/v1/ai-recruiting/abnormal_keyword/{company}", "method": "POST", "headers_to_pass": [ "*" ], "extra_config": { "github.com/devopsfaith/krakend/proxy": { "sequential": true } }, "backend": [ { "method" : "GET", "url_pattern": "/v1/companies/valid/{company}", "encoding": "json", "host": [ "http://111.111.111.111" ], "extra_config": { "github.com/devopsfaith/krakend/http": { "return_error_details": "result_auth" } } }, { "url_pattern": "/api/", "method" : "POST", "encoding" : "JSON", "host": [ "http://222.222.222.222" ], "extra_config": { "github.com/devopsfaith/krakend/http": { "return_error_details": "result_ai_resume" } } } ] }

kpacha commented 4 years ago

I'm not sure about the 404... but you shouldn't use not safe methods in your request sequence (POST is not safe). you could move the validation request to a LUA snippet (like the one used on this test: https://github.com/devopsfaith/krakend-lua/blob/master/proxy/http_test.go) and reject the request is the response isn't valid

moonhj3117 commented 4 years ago

Thank you for your answer Due to Krakend functionality, two backends (POST, POST) on one endpoint or Are two backends (GET, POST) originally provided for one endpoint?

kpacha commented 4 years ago

sending more than one requests when using "unsafe" (not safe by the RFC definition) methods is not supported out of the box. the main reasons are:

Nevertheless, the KrakenD platform offers you several ways to fulfill your requirements by extending and/or customizing the pipe with LUA snippets and go plugins. Take a look at the https://www.krakend.io/docs/extending/writing-plugins/ and https://www.krakend.io/docs/endpoints/lua/

github-actions[bot] commented 2 years ago

This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.