Middleware for SSL redirect #1729
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/5836
Description (What does it do?)
Adds a middleware function to redirect any traffic on HTTP to HTTPS.
Redirects for requests to http://mit.learn.edu are handled by the CDN, though this change blocks content from being served over HTTP if the assigned Next.js server domains are addressed directly. Very edge case as we have a CORS list, though this was highlighted while we had a whitelisted domain before the CDN was set up on RC.
How can this be tested?
Build the app for production and test that it redirects to HTTPS
yarn buildPORT=8062 yarn start/etc/hostsfile entry to 127.0.01 that does not include the string "local", e.g.127.0.01 testing.