Browse Source

Add force_https

master
Alfred 2 years ago
parent
commit
fd5bb88698
2 changed files with 4 additions and 0 deletions
  1. 1
    0
      config/config.js
  2. 3
    0
      src/index.js

+ 1
- 0
config/config.js View File

@@ -13,5 +13,6 @@ module.exports = {
13 13
         forbidden_buckets: ["xx"]
14 14
     },
15 15
     cloudviewer: {
16
+        force_https: false
16 17
     }
17 18
 };

+ 3
- 0
src/index.js View File

@@ -46,6 +46,9 @@ initializeDb(config, db => {
46 46
 			return;
47 47
 		}
48 48
 		let baseUrl = (req.baseUrl <= 1) ? req.protocol + "://" + req.headers.host : req.baseUrl;
49
+		if (config.get('cloudviewer.force_https', false)) {
50
+			baseUrl = baseUrl.replace('http:', 'https:');
51
+		}
49 52
 		let _url = req.url.replace(new RegExp("%20", 'g'), " ");
50 53
 		_url = _url.replace(new RegExp("%7D", 'g'), "}");
51 54
 		_url = _url.replace(new RegExp("%7B", 'g'), "{");

Loading…
Cancel
Save