<titledata-react-helmet="true">TLS Configuration | OAuth2 Proxy</title><metadata-react-helmet="true"name="twitter:card"content="summary_large_image"><metadata-react-helmet="true"property="og:url"content="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/tls"><metadata-react-helmet="true"name="docusaurus_locale"content="en"><metadata-react-helmet="true"name="docusaurus_version"content="7.3.x"><metadata-react-helmet="true"name="docusaurus_tag"content="docs-default-7.3.x"><metadata-react-helmet="true"property="og:title"content="TLS Configuration | OAuth2 Proxy"><metadata-react-helmet="true"name="description"content="There are two recommended configurations:"><metadata-react-helmet="true"property="og:description"content="There are two recommended configurations:"><linkdata-react-helmet="true"rel="icon"href="/oauth2-proxy/img/logos/OAuth2_Proxy_icon.svg"><linkdata-react-helmet="true"rel="canonical"href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/tls"><linkdata-react-helmet="true"rel="alternate"href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/tls"hreflang="en"><linkdata-react-helmet="true"rel="alternate"href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/tls"hreflang="x-default"><linkrel="stylesheet"href="/oauth2-proxy/assets/css/styles.19258e03.css">
<divrole="region"><ahref="#"class="skipToContent_ZgBM">Skip to main content</a></div><navclass="navbar navbar--fixed-top"><divclass="navbar__inner"><divclass="navbar__items"><buttonaria-label="Navigation bar toggle"class="navbar__toggle clean-btn"type="button"tabindex="0"><svgwidth="30"height="30"viewBox="0 0 30 30"aria-hidden="true"><pathstroke="currentColor"stroke-linecap="round"stroke-miterlimit="10"stroke-width="2"d="M4 7h22M4 15h22M4 23h22"></path></svg></button><aclass="navbar__brand"href="/oauth2-proxy/"><divclass="navbar__logo"><imgsrc="/oauth2-proxy/img/logos/OAuth2_Proxy_icon.svg"alt="OAuth2 Proxy"class="themedImage_W2Cr themedImage--light_TfLj"><imgsrc="/oauth2-proxy/img/logos/OAuth2_Proxy_icon.svg"alt="OAuth2 Proxy"class="themedImage_W2Cr themedImage--dark_oUvU"></div><bclass="navbar__title">OAuth2 Proxy</b></a><aaria-current="page"class="navbar__item navbar__link navbar__link--active"href="/oauth2-proxy/docs/">Docs</a></div><divclass="navbar__items navbar__items--right"><divclass="navbar__item dropdown dropdown--hoverable dropdown--right"><aclass="navbar__link"href="/oauth2-proxy/docs/">7.3.x</a><ulclass="dropdown__menu"><li><aclass="dropdown__link"href="/oauth2-proxy/docs/next/configuration/tls">Next</a></li><li><aaria-current="page"class="dropdown__link dropdown__link--active"href="/oauth2-proxy/docs/configuration/tls">7.3.x</a></li><li><aclass="dropdown__link"href="/oauth2-proxy/docs/7.2.x/configuration/tls">7.2.x</a></li><li><aclass="dropdown__link"href="/oauth2-proxy/docs/7.1.x/configuration/tls">7.1.x</a></li><li><aclass="dropdown__link"href="/oauth2-proxy/docs/7.0.x/configuration/tls">7.0.x</a></li><li><aclass="dropdown__link"href="/oauth2-proxy/docs/6.1.x/configuration/tls">6.1.x</a></li></ul></div><ahref="https://github.com/oauth2-proxy/oauth2-proxy"target="_blank"rel="noopener noreferrer"class="navbar__item navbar__link"><span>GitHub<svgwidth="13.5"height="13.5"aria-hidden="true"viewBox="0 0 24 24"class="iconExternalLink_I5OW"><pathfill="currentColor"d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a><divclass="toggle_Pssr toggle_TdHA toggleDisabled_jDku"><divclass="toggleTrack_SSoT"role="button"tabindex="-1"><divclass="toggleTrackCheck_XobZ"><spanclass="toggleIcon_eZtF">🌜</span></div><divclass="toggleTrackX_YkSC"><spanclass="toggleIcon_eZtF">🌞</span></div><divclass="toggleTrackThumb_uRm4"></div></div><inputtype="checkbox"class="toggleScreenReader_JnkT"aria-label="Switch between dark and light mode"></div></div></div><divrole="presentation"class="navbar-sidebar__backdrop"></div></nav><divclass="main-wrapper docs-wrapper docs-doc-page"><divclass="docPage_P2Lg"><buttonaria-label="Scroll back to top"class="clean-btn theme-back-to-top-button backToTopButton_RiI4"type="button"></button><asideclass="theme-doc-sidebar-container docSidebarContainer_rKC_"><divclass="sidebar_CW9Y"><navclass="menu thin-scrollbar menu_SkdO"><ulclass="theme-doc-sidebar-menu menu__list"><liclass="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><aclass="menu__link"href="/oauth2-proxy/docs/">Installation</a></li><liclass="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><aclass="menu__link"href="/oauth2-proxy/docs/behaviour">Behaviour</a></li><liclass="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><divclass="menu__list-item-collapsible"><aclass="menu__link menu__link--sublist menu__link--active hasHref_VCh3"aria-current="page"href="/oauth2-proxy/docs/configuration/overview">Configuration</a></div><ulstyle="display:block;overflow:visible;height:auto"class="menu__list"><liclass="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><aclass="menu__link"tabindex="0"href="/oauth2-proxy/docs/configuration/overview">Overview</a></li><liclass="theme-doc-sidebar-item-linktheme-doc-sidebar-item-link-level-2menu__
The defaults set <code>TLS1.2</code> as the minimal version.
Regardless of the minimum version configured, <code>TLS1.3</code> is currently always used as the maximal version.</p><p>The server side cipher suites are the defaults from <ahref="https://pkg.go.dev/crypto/tls#CipherSuites"target="_blank"rel="noopener noreferrer"><code>crypto/tls</code></a> of
the currently used <code>go</code> version for building <code>oauth2-proxy</code>.</p></li></ol><h3class="anchor anchorWithStickyNavbar_mojV"id="terminate-tls-at-reverse-proxy-eg-nginx">Terminate TLS at Reverse Proxy, e.g. Nginx<aclass="hash-link"href="#terminate-tls-at-reverse-proxy-eg-nginx"title="Direct link to heading"></a></h3><ol><li><p>Configure SSL Termination with <ahref="http://nginx.org/"target="_blank"rel="noopener noreferrer">Nginx</a> (example config below), Amazon ELB, Google Cloud Platform Load Balancing, or ...</p><p>Because <code>oauth2-proxy</code> listens on <code>127.0.0.1:4180</code> by default, to listen on all interfaces (needed when using an
external load balancer like Amazon ELB or Google Platform Load Balancing) use <code>--http-address="0.0.0.0:4180"</code> or
<code>--http-address="http://:4180"</code>.</p><p>Nginx will listen on port <code>443</code> and handle SSL connections while proxying to <code>oauth2-proxy</code> on port <code>4180</code>.
<code>oauth2-proxy</code> will then authenticate requests for an upstream application. The external endpoint for this example
would be <code>https://internal.yourcompany.com/</code>.</p><p>An example Nginx config follows. Note the use of <code>Strict-Transport-Security</code> header to pin requests to SSL