API Client -> OPENRESTY -> Proxy Server -> Target API

23 views
Skip to first unread message

J Khan

unread,
Jun 11, 2025, 10:05:50 AMJun 11
to openresty
Hello, I have a situation where the API client is making a REST API call, which is received by OPENRESTY, which then needs to forward it to an HTTP proxy using CONNECT, which then forwards the HTTP request to the Target API Server. I am having no luck in finding ways for OPENRESTY or NGINX to act as a PROXY Client to the Proxy Server. I find no way of specifying a proxy server and port. If I just use proxy_pass from openresty -> proxy server, it uses GET/POST/or whatever and doesn't use CONNECT which the Proxy Server is expecting. To me it seems like it should be a very common use case, but I can't seem to find a solution for it. I know that stream can allow a client to send CONNECT request and NGINX can act as a dumb proxy BUT in this case OPENRESTY/NGINX need to be the client for the proxy. I am afraid that I would have to use lua_http library but that would block the worker thread and kill all benefits of NGINX.

Any advice?

Junlong li

unread,
Jun 11, 2025, 11:15:49 AMJun 11
to openresty
We can provide this private library,would you like to buy our OpenResty XRay service?
Reply all
Reply to author
Forward
0 new messages