1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 13:29:22 +00:00

Fix HTTPS requirement

This commit is contained in:
Comunic Server 2020-03-30 16:14:40 +01:00
parent b9f50f0cb9
commit d04883cf3f
2 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,4 @@
import { conf } from "../helpers/ConfigHelper";
import { Response, Request } from "express"; import { Response, Request } from "express";
import { APIHelper } from "../helpers/APIHelper"; import { APIHelper } from "../helpers/APIHelper";
import { APIClient } from "./APIClient"; import { APIClient } from "./APIClient";
@ -486,7 +487,7 @@ export class RequestHandler {
if(client.domain) { if(client.domain) {
const allowedOrigin = "http://" + client.domain; const allowedOrigin = (conf().force_clients_https ? "https://" : "http://") + client.domain;
const referer = this.req.get("Referer"); const referer = this.req.get("Referer");
if(!referer || !referer.startsWith(allowedOrigin)) if(!referer || !referer.startsWith(allowedOrigin))

View File

@ -20,7 +20,8 @@ export interface Configuration {
storageURL : string, storageURL : string,
storagePath : string, storagePath : string,
database : DatabaseConfiguration, database : DatabaseConfiguration,
proxy ?: string proxy ?: string,
force_clients_https ?: boolean
} }
export class ConfigurationHelper { export class ConfigurationHelper {