|
|
@@ -7,6 +7,7 @@ const axios = require('axios');
|
|
|
const ApiResponse = require('../util/apiResponse');
|
|
|
|
|
|
module.exports = function(crowi, app) {
|
|
|
+ const config = crowi.getConfig();
|
|
|
const Page = crowi.models.Page;
|
|
|
|
|
|
// load GROWI agent script for HackMD
|
|
|
@@ -33,7 +34,13 @@ module.exports = function(crowi, app) {
|
|
|
agentScriptContentTpl = swig.compileFile(agentScriptPath);
|
|
|
}
|
|
|
|
|
|
- const origin = `${req.protocol}://${req.get('host')}`;
|
|
|
+ var origin = `${req.protocol}://${req.get('host')}`;
|
|
|
+
|
|
|
+ // use config.crowi['app:url'] when exist req.headers['x-forwarded-proto'].
|
|
|
+ // refs: lib/crowi/express-init.js
|
|
|
+ if (config.crowi && config.crowi['app:url']) {
|
|
|
+ origin = config.crowi['app:url'];
|
|
|
+ }
|
|
|
|
|
|
// generate definitions to replace
|
|
|
const definitions = {
|