drogon
drogon copied to clipboard
Options return for path /*
curious why this is included and is hardcoded and not configurable? what is the reason for this?
if (req->method() == Options && (req->path() == "*" || req->path() == "/*"))
{
auto resp = HttpResponse::newHttpResponse();
resp->setContentTypeCode(ContentType::CT_TEXT_PLAIN);
resp->addHeader("Allow", "GET,HEAD,POST,PUT,DELETE,OPTIONS,PATCH");
resp->setExpiredTime(0);
callback(resp);
return;
}
where the code can be found: https://github.com/drogonframework/drogon/blob/59cd4366c75c8f15c011f476f4850b97086f5de5/lib/src/HttpServer.cc#L419
An OPTIONS request with a path of * (i.e. OPTIONS * HTTP/1.1) is a server-wide request. It is used by the client to ask:
"What HTTP methods does this server support, regardless of a specific resource?"
This is defined in RFC 9110, Section 9.3.7.