Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add CORS headers #608

Merged
merged 3 commits into from
Jun 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
4 changes: 3 additions & 1 deletion strings_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -315,4 +317,4 @@ const char * const AUTH_MODE_NAMES[] PROGMEM
};
#endif

const char* const WIFI_MODES[] PROGMEM = { "NULL", "STA", "AP", "STA+AP" };
const char* const WIFI_MODES[] PROGMEM = { "NULL", "STA", "AP", "STA+AP" };