Configuring PROXY Protocol in Connected Mode
For use cases when Flex Gateway is deployed behind a load balancer or other proxy service, configure PROXY protocol to preserve client IP addresses across multiple layers of NAT or TCP proxies.
In PROXY protocol, the load balancer or other proxy service sends the PROXY protocol header containing the client address and additional information to Flex Gateway. To learn more about PROXY protocol, see the HAProxy specification.
Enabling PROXY protocol only enables Flex Gateway to receive the PROXY protocol header. Your load balancer or other proxy service must support PROXY protocol to transmit the header.
Enable PROXY Protocol for Flex Gateway as a Linux Service
-
Create a YAML configuration file in the Flex Gateway configuration directory:
sudo touch /usr/local/share/mulesoft/flex-gateway/conf.d/proxy-protocol-config.yaml
-
Update the file with the PROXY protocol configuration file:
apiVersion: gateway.mulesoft.com/v1alpha1 kind: Configuration metadata: name: config spec: proxyProtocol: enabled: true
Enable PROXY Protocol for Flex Gateway in a Docker Container
If you have already added a volume for a folder with your Flex Gateway configuration files, skip to the last step. |
-
Press Ctrl+C to stop your Flex Gateway and any replicas.
-
Create a folder named
app
in the directory with your Flex Gateway configuration files. -
Restart your Flex Gateway with an additional volume for the new
app
directory:docker run --rm \ -v "$(pwd)":/usr/local/share/mulesoft/flex-gateway/conf.d \ -p 8080:8080 \ mulesoft/flex-gateway
Specify an optional name you want to assign to your Flex Replica by including the following: -e FLEX_NAME=<name-for-flex-replica> \
. -
Create and save a YAML configuration file in your
app
folder with your PROXY protocol configuration details.apiVersion: gateway.mulesoft.com/v1alpha1 kind: Configuration metadata: name: config spec: proxyProtocol: enabled: true
Enable PROXY Protocol for Flex Gateway in a Kubernetes Cluster
To configure PROXY protocol for Flex Gateway, create a new resource using a YAML configuration file with your PROXY protocol details.
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
name: config
spec:
proxyProtocol:
enabled: true