mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Allow api3 behind reverse proxy (#5631)
* Allow api3 behind reverse proxy * fix test Co-authored-by: Sulka Haro <sulka@sulka.net>
This commit is contained in:
co-authored by
Sulka Haro
parent
ccd591d4ef
commit
f6f7e18888
@@ -56,10 +56,10 @@ function authenticate (opCtx) {
|
||||
return resolve({ shiros: [ adminShiro ] });
|
||||
}
|
||||
|
||||
if (req.protocol !== 'https') {
|
||||
return reject(
|
||||
opTools.sendJSONStatus(res, apiConst.HTTP.FORBIDDEN, apiConst.MSG.HTTP_403_NOT_USING_HTTPS));
|
||||
}
|
||||
// if (req.protocol !== 'https') {
|
||||
// return reject(
|
||||
// opTools.sendJSONStatus(res, apiConst.HTTP.FORBIDDEN, apiConst.MSG.HTTP_403_NOT_USING_HTTPS));
|
||||
// }
|
||||
|
||||
const checkDateResult = checkDateHeader(opCtx);
|
||||
if (checkDateResult !== true) {
|
||||
@@ -123,4 +123,4 @@ module.exports = {
|
||||
authenticate,
|
||||
checkPermission,
|
||||
demandPermission
|
||||
};
|
||||
};
|
||||
|
||||
+11
-11
@@ -33,16 +33,16 @@ describe('Security of REST API3', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should require HTTPS', async () => {
|
||||
if (semver.gte(process.version, '10.0.0')) {
|
||||
let res = await request(self.http.baseUrl) // hangs on 8.x.x (no reason why)
|
||||
.get('/api/v3/test')
|
||||
.expect(403);
|
||||
|
||||
res.body.status.should.equal(403);
|
||||
res.body.message.should.equal(apiConst.MSG.HTTP_403_NOT_USING_HTTPS);
|
||||
}
|
||||
});
|
||||
// it('should require HTTPS', async () => {
|
||||
// if (semver.gte(process.version, '10.0.0')) {
|
||||
// let res = await request(self.http.baseUrl) // hangs on 8.x.x (no reason why)
|
||||
// .get('/api/v3/test')
|
||||
// .expect(403);
|
||||
//
|
||||
// res.body.status.should.equal(403);
|
||||
// res.body.message.should.equal(apiConst.MSG.HTTP_403_NOT_USING_HTTPS);
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
it('should require Date header', async () => {
|
||||
@@ -186,4 +186,4 @@ describe('Security of REST API3', function() {
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user