Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.

Enforce HTTPS on godoc.org #325

Merged
merged 2 commits into from
Sep 28, 2015
Merged

Enforce HTTPS on godoc.org #325

merged 2 commits into from
Sep 28, 2015

Conversation

garyburd
Copy link
Contributor

Fixes #304.

Redirect HTTP links to HTTPS and set HSTS correctly.

This is specific to the godoc.org set up (with nginx passing a X-Scheme
header back) and without fixing up api.godoc.org.

Fixes #304.
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

if host == "godoc.org" {
// Because https is not used api.godoc.org, the includeSubDomains
// parameter is not used here.
resp.Header().Add("Strict-Transport-Security", "max-age=631138519; preload")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this after the following if block (don't set the HSTS header on HTTP requests).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @agl does this header look right to you? I'm concerned about the length of the timeout. What's the best practice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the code after the if block.

Copy link

@agl agl Sep 30, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Merge httpsEnforcerHandler and hostMux handlers to rootHandler.
- Set host name in redirect.
- Strip port when comparing host names.
- Do not set includeSubdomains parameter in HSTS header as api.godoc.org
  is not served via http.
adg added a commit that referenced this pull request Sep 28, 2015
Enforce HTTPS on godoc.org
@adg adg merged commit dc8de5d into golang:master Sep 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants