Class ProxyServer
java.lang.Object
io.fluxzero.proxy.ProxyServer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault connector idle timeout: 60 secondsstatic final intDefault maximum request and response header size: 1 MiBstatic final intDefault maximum in-flight web requests accepted by the proxy.static final longDefault maximum multipart request body size: 1 GiBstatic final intDefault maximum queued outgoing websocket sends per session.static final longDefault maximum request body size: 256 MiBstatic final intDefault Jetty maximum platform thread count.static final intDefault Jetty minimum platform thread count.static final intDefault initial response header buffer capacity: 8 KiBstatic final longDefault websocket idle timeout: 120 secondsstatic final longDefault delay between proxy websocket keep-alive pings: 55 secondsstatic final longDefault time allowed for receiving a proxy websocket keep-alive pong: 10 secondsstatic final StringMaximum HTTP/2 response-header list size in bytes.static final StringInitial response header buffer capacity in bytes.static final StringWhether Jetty uses direct buffers for HTTP output. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProxyServer(ProxyRequestHandler proxyHandler, org.eclipse.jetty.server.Server server, int port, io.fluxzero.common.Registration shutdownRegistration, Runnable forceShutdown, io.fluxzero.common.Registration ownedClientShutdown, boolean gracefulShutdown, AtomicReference<io.fluxzero.proxy.ProxyServer.LifecycleState> lifecycleState, Duration drainDelay, Duration shutdownTimeout) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()booleanisReady()Returns whether the proxy has reached runtime readiness and is not draining.static voidStandalone process entry point.default io.fluxzero.common.Registrationmerge(io.fluxzero.common.Registration arg0) static ProxyServerstart()Starts an embedded proxy server using the configured port and runtime base URL.static ProxyServerstart(ProxyServerConfig config) Starts an embedded proxy server with explicit configuration.static ProxyServerstart(ProxyServerConfig config, String host) Starts an embedded proxy on an explicit interface, with the port and backend settings fromconfig.
-
Field Details
-
DEFAULT_MAX_REQUEST_BODY_SIZE
public static final long DEFAULT_MAX_REQUEST_BODY_SIZEDefault maximum request body size: 256 MiB- See Also:
-
DEFAULT_MAX_MULTIPART_REQUEST_BODY_SIZE
public static final long DEFAULT_MAX_MULTIPART_REQUEST_BODY_SIZEDefault maximum multipart request body size: 1 GiB- See Also:
-
DEFAULT_MAX_HEADER_SIZE
public static final int DEFAULT_MAX_HEADER_SIZEDefault maximum request and response header size: 1 MiB- See Also:
-
DEFAULT_RESPONSE_HEADER_BUFFER_SIZE
public static final int DEFAULT_RESPONSE_HEADER_BUFFER_SIZEDefault initial response header buffer capacity: 8 KiB- See Also:
-
DEFAULT_IDLE_TIMEOUT_MILLIS
public static final long DEFAULT_IDLE_TIMEOUT_MILLISDefault connector idle timeout: 60 seconds- See Also:
-
DEFAULT_MAX_THREADS
public static final int DEFAULT_MAX_THREADSDefault Jetty maximum platform thread count.- See Also:
-
DEFAULT_MIN_THREADS
public static final int DEFAULT_MIN_THREADSDefault Jetty minimum platform thread count.- See Also:
-
DEFAULT_MAX_IN_FLIGHT_WEB_REQUESTS
public static final int DEFAULT_MAX_IN_FLIGHT_WEB_REQUESTSDefault maximum in-flight web requests accepted by the proxy. A value of0disables this guardrail.- See Also:
-
DEFAULT_MAX_PENDING_WEBSOCKET_SENDS
public static final int DEFAULT_MAX_PENDING_WEBSOCKET_SENDSDefault maximum queued outgoing websocket sends per session.- See Also:
-
DEFAULT_WEBSOCKET_IDLE_TIMEOUT_MILLIS
public static final long DEFAULT_WEBSOCKET_IDLE_TIMEOUT_MILLISDefault websocket idle timeout: 120 seconds- See Also:
-
DEFAULT_WEBSOCKET_PING_DELAY_MILLIS
public static final long DEFAULT_WEBSOCKET_PING_DELAY_MILLISDefault delay between proxy websocket keep-alive pings: 55 seconds- See Also:
-
DEFAULT_WEBSOCKET_PING_TIMEOUT_MILLIS
public static final long DEFAULT_WEBSOCKET_PING_TIMEOUT_MILLISDefault time allowed for receiving a proxy websocket keep-alive pong: 10 seconds- See Also:
-
RESPONSE_HEADER_BUFFER_SIZE_PROPERTY
Initial response header buffer capacity in bytes. The environment variable isFLUXZERO_PROXY_RESPONSE_HEADER_BUFFER_SIZE. The default is 8 KiB. This controls header buffering, not response body size or the maximum accepted header size. Larger headers use Jetty's overflow path up to the separately configured maximum.- See Also:
-
USE_OUTPUT_DIRECT_BYTE_BUFFERS_PROPERTY
Whether Jetty uses direct buffers for HTTP output. The environment variable isFLUXZERO_PROXY_USE_OUTPUT_DIRECT_BYTE_BUFFERS. Disable this to account output buffers on the Java heap. The default istrue.- See Also:
-
HTTP2_MAX_RESPONSE_HEADER_SIZE_PROPERTY
Maximum HTTP/2 response-header list size in bytes. The environment variable isFLUXZERO_PROXY_HTTP2_MAX_RESPONSE_HEADER_SIZE. The default is 16 KiB, independently offluxzero.defaults.version. An explicit positive value overrides this default. The shared response maximum and the peer's advertised maximum still cap this value. HTTP/1 headers and incoming requests are unaffected.- See Also:
-
-
Constructor Details
-
ProxyServer
protected ProxyServer(ProxyRequestHandler proxyHandler, org.eclipse.jetty.server.Server server, int port, io.fluxzero.common.Registration shutdownRegistration, Runnable forceShutdown, io.fluxzero.common.Registration ownedClientShutdown, boolean gracefulShutdown, AtomicReference<io.fluxzero.proxy.ProxyServer.LifecycleState> lifecycleState, Duration drainDelay, Duration shutdownTimeout)
-
-
Method Details
-
main
-
start
Starts an embedded proxy server using the configured port and runtime base URL.The port is resolved from
FLUXZERO_PROXY_PORT,PROXY_PORT, or8080, in that order. The Fluxzero runtime URL is resolved fromFLUXZERO_BASE_URL,FLUX_BASE_URL, orFLUX_URL, in that order. The returned server owns the created Fluxzero client and forward proxy consumer; callers should stop all embedded proxy resources by callingcancel().This method does not register a JVM shutdown hook, create a Fluxzero keepalive thread, or set a global Fluxzero application instance. Use
main(String[])for standalone process startup.- Returns:
- a ProxyServer instance representing the started proxy server and owned embedded resources
-
start
Starts an embedded proxy server with explicit configuration.The returned server owns the created Fluxzero client and forward proxy consumer; callers should stop all embedded proxy resources by calling
cancel().- Parameters:
config- proxy server configuration- Returns:
- a ProxyServer instance representing the started proxy server and owned embedded resources
-
start
Starts an embedded proxy on an explicit interface, with the port and backend settings fromconfig. Use"127.0.0.1"for isolated loopback tests; other overloads retain their all-interface binding. The returned proxy owns its client and forward consumer and must be stopped withcancel().- Parameters:
config- proxy configurationhost- interface address to bind- Returns:
- the started proxy
-
isReady
public boolean isReady()Returns whether the proxy has reached runtime readiness and is not draining. -
cancel
public void cancel() -
merge
default io.fluxzero.common.Registration merge(io.fluxzero.common.Registration arg0)
-