From 128214a1596e12d1cd2c704558bbe3a9af5b30fe Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 14 May 2018 11:47:13 +0300 Subject: [PATCH 1/2] add CORS headers this will allow external portal on the network to send credentials via browser. --- WiFiManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 2011b2b6..8a2bd79d 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -1159,6 +1159,7 @@ void WiFiManager::handleWifiSave() { page += FPSTR(HTTP_END); server->sendHeader(FPSTR(HTTP_HEAD_CL), String(page.length())); + server->sendHeader(HTTP_HEAD_CORS, HTTP_HEAD_CORS_ALLOW_ALL); server->send(200, FPSTR(HTTP_HEAD_CT), page); DEBUG_WM(DEBUG_DEV,F("Sent wifi save page")); From 24a25fc687cafc3cb8a2251a17352329596093e4 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 14 May 2018 11:47:26 +0300 Subject: [PATCH 2/2] add CORS headers this will allow external portal on the network to send credentials via browser. --- strings_en.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/strings_en.h b/strings_en.h index 2cb9f7ab..5444d009 100644 --- a/strings_en.h +++ b/strings_en.h @@ -276,6 +276,8 @@ const char T_h[] PROGMEM = "{h}"; // @token h const char HTTP_HEAD_CL[] PROGMEM = "Content-Length"; const char HTTP_HEAD_CT[] PROGMEM = "text/html"; const char HTTP_HEAD_CT2[] PROGMEM = "text/plain"; +const char HTTP_HEAD_CORS[] PROGMEM = "Access-Control-Allow-Origin"; +const char HTTP_HEAD_CORS_ALLOW_ALL[] PROGMEM = "*"; const char * const WIFI_STA_STATUS[] PROGMEM { @@ -315,4 +317,4 @@ const char * const AUTH_MODE_NAMES[] PROGMEM }; #endif -const char* const WIFI_MODES[] PROGMEM = { "NULL", "STA", "AP", "STA+AP" }; \ No newline at end of file +const char* const WIFI_MODES[] PROGMEM = { "NULL", "STA", "AP", "STA+AP" };