fieldenms / tg

Trident Genesis
MIT License
14 stars 7 forks source link

Embedded reverse proxy service #2262

Open 01es opened 2 months ago

01es commented 2 months ago

Description

This issue covers the work to establish an embedded Jetty-based proxy service that could be used in TG-based applications for various purposes without the need to utilise external proxy servers, such as HAProxy or nginx.

The driving use case is ability to facilitate the SSE capability, which uses a separate instance of Jetty, without an external proxy server. However, it is also envisaged that the proxy functionality can be useful for providing access to web services from web clients, without requiring those clients to provide all the information necessary to access the web services.

For example, Places API requires an API key for access. A web client is authenticated with a TG-based app's backend and should not contain information about such API key to make requests to Places API. This can be solved by using a proxy.

Configuration properties

Timeout values are in millis.

##############################
##### Jetty Proxy config #####
##############################
proxy.enabled=true
proxy.jetty.port=8090
proxy.jetty.threadPool.minThreads=5
proxy.jetty.threadPool.maxThreads=50
proxy.jetty.threadPool.idleTimeout=30000
proxy.jetty.connector.acceptors=2
proxy.backendTimeout=60000

Expected outcome

A proxy service that could have custom application logic with the out-of-the-box functionality for routing SSE requests.