From d1c85fc3fa9b9705fbbc366c11f7d2846e36b192 Mon Sep 17 00:00:00 2001 From: Geek_cat <36782632+zhzhzhy@users.noreply.github.com> Date: Tue, 20 Sep 2022 09:01:00 +0800 Subject: [PATCH] Allow CORS for web_server (#3819) --- esphome/components/web_server_base/web_server_base.h | 1 + 1 file changed, 1 insertion(+) diff --git a/esphome/components/web_server_base/web_server_base.h b/esphome/components/web_server_base/web_server_base.h index bc37337ca5..cdabe66d44 100644 --- a/esphome/components/web_server_base/web_server_base.h +++ b/esphome/components/web_server_base/web_server_base.h @@ -81,6 +81,7 @@ class WebServerBase : public Component { return; } this->server_ = std::make_shared(this->port_); + DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*"); this->server_->begin(); for (auto *handler : this->handlers_)