From 36f6c822ad491e938cda5ab1c960e0d2adffc303 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Sun, 30 Jun 2019 01:25:05 +0300 Subject: [PATCH] Configure WEB_REMOTE_DOMAIN at runtime (#1789) * Configure WEB_REMOTE_DOMAIN at runtime * typo --- code/espurna/ws.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/espurna/ws.ino b/code/espurna/ws.ino index 075dad2d..689a3d09 100644 --- a/code/espurna/ws.ino +++ b/code/espurna/ws.ino @@ -543,10 +543,11 @@ void wsSetup() { webServer()->addHandler(&_ws); // CORS - #ifdef WEB_REMOTE_DOMAIN - DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", WEB_REMOTE_DOMAIN); + const String webDomain = getSetting("webDomain", WEB_REMOTE_DOMAIN); + DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", webDomain); + if (!webDomain.equals("*")) { DefaultHeaders::Instance().addHeader("Access-Control-Allow-Credentials", "true"); - #endif + } webServer()->on("/auth", HTTP_GET, _onAuth);