Allow CORS for web_server (#3819)

This commit is contained in:
Geek_cat 2022-09-20 09:01:00 +08:00 committed by GitHub
parent 55ad45e3ee
commit d1c85fc3fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,6 +81,7 @@ class WebServerBase : public Component {
return;
}
this->server_ = std::make_shared<AsyncWebServer>(this->port_);
DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*");
this->server_->begin();
for (auto *handler : this->handlers_)