Merge pull request #466 from sharetribe/cookie-secure-flag

Cookie secure flag
This commit is contained in:
Vesa Luusua 2017-10-05 14:55:35 +03:00 committed by GitHub
commit 6d6e3b9710
5 changed files with 12 additions and 6 deletions

View file

@ -34,7 +34,7 @@
"redux-thunk": "^2.2.0",
"sanitize.css": "^5.0.0",
"sharetribe-scripts": "0.9.2",
"sharetribe-sdk": "git+ssh://git@github.com/sharetribe/sharetribe-sdk-js#e2fe4c3be061bfbefdb2db1fa5ed2a8a5d4d4ffe",
"sharetribe-sdk": "git+ssh://git@github.com/sharetribe/sharetribe-sdk-js#c50f3798037ba5c310076f069bbafec41a170782",
"source-map-support": "^0.4.15",
"url": "^0.11.0",
"raven-js": "^3.6.0",

View file

@ -36,7 +36,7 @@ const PORT = process.env.PORT || 4000;
const CLIENT_ID = process.env.REACT_APP_SHARETRIBE_SDK_CLIENT_ID ||
'08ec69f6-d37e-414d-83eb-324e94afddf0';
const BASE_URL = process.env.REACT_APP_SHARETRIBE_SDK_BASE_URL || 'http://localhost:8088';
const ENFORCE_SSL = process.env.SERVER_SHARETRIBE_ENFORCE_SSL === 'true';
const USING_SSL = process.env.REACT_APP_SHARETRIBE_USING_SSL === 'true';
const TRUST_PROXY = process.env.SERVER_SHARETRIBE_TRUST_PROXY || null;
const app = express();
@ -53,13 +53,13 @@ app.use(log.requestHandler());
// See: https://www.npmjs.com/package/helmet
app.use(helmet());
// Redirect HTTP to HTTPS if ENFORCE_SSL is `true`.
// Redirect HTTP to HTTPS if USING_SSL is `true`.
// This also works behind reverse proxies (load balancers) as they are for example used by Heroku.
// In such cases, however, the TRUST_PROXY parameter has to be set (see below)
//
// Read more: https://github.com/aredo/express-enforces-ssl
//
if (ENFORCE_SSL) {
if (USING_SSL) {
app.use(enforceSsl());
}
@ -97,6 +97,7 @@ app.get('*', (req, res) => {
clientId: CLIENT_ID,
req,
res,
secure: USING_SSL,
});
const sdk = sharetribeSdk.createInstance({

View file

@ -14,6 +14,9 @@ const currency = process.env.REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY || 'USD';
// Sentry DSN (Data Source Name), a client key for authenticating calls to Sentry
const sentryDsn = process.env.REACT_APP_PUBLIC_SENTRY_DSN;
// If webapp is using SSL (i.e. it's behind 'https' protocol)
const usingSSL = process.env.REACT_APP_SHARETRIBE_USING_SSL === 'true';
// Currency formatting options.
// See: https://github.com/yahoo/react-intl/wiki/API#formatnumber
//
@ -213,6 +216,7 @@ const config = {
siteTwitterHandle,
facebookAppId,
sentryDsn,
usingSSL,
};
export default config;

View file

@ -64,6 +64,7 @@ if (typeof window !== 'undefined') {
const sdk = createInstance({
clientId: config.sdk.clientId,
baseUrl: config.sdk.baseUrl,
secure: config.usingSSL,
typeHandlers: [
{
type: BigDecimal,

View file

@ -6147,9 +6147,9 @@ sharetribe-scripts@0.9.2:
optionalDependencies:
fsevents "1.0.17"
"sharetribe-sdk@git+ssh://git@github.com/sharetribe/sharetribe-sdk-js#e2fe4c3be061bfbefdb2db1fa5ed2a8a5d4d4ffe":
"sharetribe-sdk@git+ssh://git@github.com/sharetribe/sharetribe-sdk-js#c50f3798037ba5c310076f069bbafec41a170782":
version "0.0.1"
resolved "git+ssh://git@github.com/sharetribe/sharetribe-sdk-js#e2fe4c3be061bfbefdb2db1fa5ed2a8a5d4d4ffe"
resolved "git+ssh://git@github.com/sharetribe/sharetribe-sdk-js#c50f3798037ba5c310076f069bbafec41a170782"
dependencies:
axios "^0.15.3"
js-cookie "^2.1.3"