-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
320 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// ACME (Let's Encrypt) requires HTTP access to paths with this prefix. | ||
const ACME_CHALLENGE_PATH = '/.well-known/acme-challenge/'; | ||
|
||
// skip rewriting this request? | ||
const skipRedirect = (req) => { | ||
const remoteProto = req.headers['x-forwarded-proto']; | ||
// Prefer the header over req.secure. The client->lb connection differ in | ||
// either direction from the lb -> server connection. | ||
const proto = remoteProto || (req.secure ? 'https' : 'https'); | ||
// Avoid recursive redirects, and forwarding ACME challenges. | ||
return proto === 'https' || req.path.startsWith(ACME_CHALLENGE_PATH); | ||
}; | ||
|
||
// rewrite this request's URL as HTTPS | ||
const rewrite = req => `https://${req.get('Host')}${req.url}`; | ||
|
||
// ExpressJS middleware | ||
const sslify = (req, res, next) => (skipRedirect(req) ? next() : res.redirect(rewrite(req))); | ||
|
||
module.exports = sslify; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import axios from 'axios'; | ||
import { API_SERVER_URL } from './settings'; | ||
|
||
const apiClient = axios.create({ | ||
baseURL: API_SERVER_URL, | ||
}); | ||
|
||
export default apiClient; |
Oops, something went wrong.