// Module included in the following assemblies:
// * networking/configuring-routing.adoc
// * microshift_networking/microshift-configuring-routes.adoc

:_mod-docs-content-type: PROCEDURE
[id="nw-disabling-hsts_{context}"]
= Disabling HTTP Strict Transport Security per-route

[role="_abstract"]
To allow unencrypted connections or troubleshoot access issues, disable HTTP Strict Transport Security (HSTS) for a specific route. Setting the `max-age` route annotation to `0` instructs browsers to stop enforcing HTTPS requirements on the route host.

.Prerequisites
ifndef::microshift[]
* You are logged in to the cluster with a user with administrator privileges for the project.
endif::microshift[]
ifdef::microshift[]
* You have root access to the cluster.
endif::microshift[]
* You installed the {oc-first}.

.Procedure

* To disable HSTS, enter the following to set the `max-age` value in the route annotation to `0`:
+
[source,terminal]
----
$ oc annotate route <route_name> -n <namespace> --overwrite=true "haproxy.router.openshift.io/hsts_header"="max-age=0"
----
+
[TIP]
====
You can alternatively apply the following YAML to create the config map for disabling HSTS per-route:

[source,yaml]
----
kind: Route
apiVersion: route.openshift.io/v1
metadata:
  annotations:
    haproxy.router.openshift.io/hsts_header: max-age=0
----
====

* To disable HSTS for every route in a namespace, enter the following command:
+
[source,terminal]
----
$ oc annotate route --all -n <namespace> --overwrite=true "haproxy.router.openshift.io/hsts_header"="max-age=0"
----

.Verification

* To query the annotation for all routes, enter the following command:
+
[source,terminal]
----
$ oc get route  --all-namespaces -o go-template='{{range .items}}{{if .metadata.annotations}}{{$a := index .metadata.annotations "haproxy.router.openshift.io/hsts_header"}}{{$n := .metadata.name}}{{with $a}}Name: {{$n}} HSTS: {{$a}}{{"\n"}}{{else}}{{""}}{{end}}{{end}}{{end}}'
----
+
.Example output
[source,terminal]
----
Name: routename HSTS: max-age=0
----
