Comments (4)
@me-no-dev this should also be in the readme, in my opinion. I first had the impression TLS wasn't supported. beginSecure
isn't mentioned at all, neither are TLS or SSL.
from espasyncwebserver.
Trying to setup some basic code to test, wondering why this doesn't work.
AsyncWebServer server(443); // The Webserver
server.onNotFound ( [](AsyncWebServerRequest *request) {
Serial.println("Page Not Found: "+ request->url());
for(int i=0; i< request->headers(); i++){
Serial.println("server.header:"+ request->headerName(i)+ ":"+ request->header(i));
}
request->send ( 200, "text/html", "it works, but url not found" );
} );
Serial.println( "HTTP server is starting" );
server.beginSecure("server.cer", "server.key", NULL);
Serial.println( "HTTP server is starting" );
from espasyncwebserver.
You need to provide callback to load the certificate :)
server.onSslFileRequest([](void * arg, const char *filename, uint8_t **buf) -> int {
Serial.printf("SSL File: %s\n", filename);
File file = SPIFFS.open(filename, "r");
if(file){
size_t size = file.size();
uint8_t * nbuf = (uint8_t*)malloc(size);
if(nbuf){
size = file.read(nbuf, size);
file.close();
*buf = nbuf;
return size;
}
file.close();
}
*buf = 0;
return 0;
}, NULL);
server.beginSecure("/server.cer", "/server.key", NULL);
from espasyncwebserver.
Thank you. That works.
from espasyncwebserver.
Related Issues (20)
- fragmentation
- ESP8266 goin down when get JSON string. HOT 1
- where i can get request if i mast send JSON to all connected clients by timer ?! no good exapmles no information! HOT 2
- Serving SPIFFS from a subdirectory raises 500 status code on some files HOT 1
- error: cannot bind non-const lvalue reference of type 'ArduinoJson::V704PB2::JsonObject&' to an rvalue of type 'ArduinoJson::V704PB2::detail::enable_if<true, ArduinoJson::V704PB2::JsonObject>::type' {aka 'ArduinoJson::V704PB2::JsonObject'} HOT 1
- abracadabra in serial HOT 1
- after long time 8+ i have spam in serial
- AsyncWebServerRequest Questions HOT 2
- Send content with beginChunkedResponse
- Question: is it possible to replicate AsyncWebSocket with WebServer in arduino-esp32 v3.0.0 ? HOT 4
- AsyncWebServer Questions HOT 6
- Images won't load randomly
- Compiling issues HOT 8
- I Can't make the web explorer to offer to save credentials
- Change bool AsyncStaticWebHandler::canHandle to use exact match instead of String::startsWith(_uri)
- small ddos (press F5) crash: async_tcp ....watchdog got triggered HOT 2
- Compilation Error for Newer ESP32 HOT 3
- possible memory leak at send_p?
- Forwarding Webserver with websockets HOT 2
- Get new client ID at every refresh :( HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espasyncwebserver.