DocsEmissary-ingress
1.14
Cleartext support
Cleartext support
While most modern web applications will choose to encrypt all traffic, there are reasons why you will want to support clients who access your website without encryption in cleartext.
Emissary-ingress supports both forcing
automatic redirection to HTTPS and
serving cleartext traffic on a Host.
Cleartext routing
Emissary-ingress has full support for routing cleartext traffic to upstream services
for a Host.
Only cleartext
The default for the Open-Source Emissary-ingress is to serve cleartext on port 8080 in the container. See TLS documentation for information on how to configure TLS termination.
For Ambassador Edge Stack, TLS termination is enabled by default with a
self-signed certificate or an ACME Host. To disable TLS termination in Ambassador Edge Stack, delete any existing Hosts and set the
requestPolicy.insecure.action to Route in a Host:
WARNING - Host Configuration: The
requestPolicyproperty of theHostCRDis applied globally within an Emissary-ingress instance, even if it is applied to only oneHostwhen multipleHosts are configured. DifferentrequestPolicybehaviors cannot be applied to differentHosts. It is recommended to apply an identicalrequestPolicyto allHosts instead of assuming the behavior, to create a more human readable config.If a requestPolicy is not defined for a
Host, it's assumed to beRedirect, so even if aHostdoes not specify it, the defaultrequestPolicyofRedirectwill be applied to allHosts in that Emissary-ingress instance. If the behavior expected out of Emissary-ingress is anything other thanRedirect, it must be explicitly enumerated in all Host resources.Unexpected behavior can occur when multiple
Hostresources are not using the same value forrequestPolicy.For more information, please refer to the
Hostdocumentation.The
insecure-actioncan be one of:
Redirect(the default): redirect to HTTPSRoute: go ahead and route as normal; this will allow handling HTTP requests normallyReject: reject the request with a 400 response
HTTPS and cleartext
Emissary-ingress can also support serving both HTTPS and cleartext traffic from a single Emissary-ingress.
This configuration is the same whether you are running the Open-Source Emissary-ingress or the Ambassador Edge Stack. The configuration is very similar to the
Host above but with the Host configured to terminate TLS.
With the above configuration, we are tell Emissary-ingress to terminate TLS with the
certificate in the example-cert Secret and route cleartext traffic that
comes in over port 8080.
HTTP->HTTPS redirection
Most modern websites that force HTTPS will also automatically redirect any requests that come into it over HTTP. In Ambassador Edge Stack, this is enabled by default but can easily be enabled in any version of Emissary-ingress.
In Emissary-ingress, this is configured by setting the
insecure.action in a Host to Redirect.
Emissary-ingress will then enable cleartext redrection in two ways.
First, Emissary-ingress will listen on the insecure.additionalPort and consider any
traffic on this port as insecure and redirect it to HTTPS.
Additionally, Emissary-ingress will also check the X-Forwarded-Proto header of
the incoming request on the secure port (8443)and issue a 301 redirect if
it is set to HTTP.
The value of X-Forwarded-Proto is dependent on whatever is forwarding traffic
to Emissary-ingress. A couple of options are
Layer 4 Load Balancer, Proxy, or direct from the client:
X-Forwarded-Protois not set or is untrusted. Envoy will set it based off the protocol of the incoming request.If Envoy determines the request is encrypted, it will be set to
HTTPS. If not, it will be set toHTTP.Layer 7 Load Balancer or Proxy:
X-Forwarded-Protois set by the load balancer or proxy and trusted by Envoy. Envoy will trust the value ofX-Forwarded-Foreven if the request comes in over cleartext.
Summary
Ambassador Edge Stack will enable cleartext redirection by default.
To enable cleartext redirection in any version of Emissary-ingress, simply configure
a Host to redirect cleartext to HTTPS like below:
ON THIS PAGE