Request to the API and follow the path from the response

1. The problem I’m having:

Hello. Sorry for the newbie. Clarifications: The API processes requests and deploys the application on a specific port, confirming with a response containing a connection string to the deployed application, for example the API response string: http//:10.10.10.99:6000.
How to go to the address from the answer?

3. Caddy version:

v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=

4. How I installed and ran Caddy:

according to instructions for windows 10

C:\Caddy>caddy.exe run

Caddyfile:
:2015 {
handle_path /api/* {
#Request to create an application Sentosa
redir http://10.10.10.99:8020/app?name=sentosa
# ???
}
handle {
root C:/www/
file_server
}
}

Thanks a lot for any advice

I think you’re looking for reverse_proxy, not redir.

Please mind your post’s formatting. Use code blocks when posting your config (click the </> button when editing your post).

Please completely fill out the help topic template as per the forum rules.

1 Like

Thank you for your time.
This won’t work.
The documentation states…" Upstream addresses cannot contain paths or query strings, as that would imply simultaneous rewriting the request while proxying, which behavior is not defined or supported. You may use the [rewrite] ".
Maybe somehow change the way the API works, add an auxiliary “service header”
Thank you

Your question is unclear. Please elaborate on what you’re trying to do. Provide as much detail as possible.

1 Like

I understand… on the API side in the response to redir, you need to set the “Location” header to the path value for the transition and set the status value to = 3xx. Then you can use redir with parameters for the API.
Thank you, problem solved.

I’m still confused. What’s the problem?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.