]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Rename the option to [webserver-]cross-origin-request-header
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 11 May 2026 07:14:30 +0000 (09:14 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 11 May 2026 07:14:30 +0000 (09:14 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
docs/settings.rst
docs/upgrading.rst
pdns/auth-main.cc
pdns/recursordist/docs/upgrade.rst
pdns/recursordist/rec-rust-lib/rust/src/web.rs
pdns/recursordist/rec-rust-lib/table.py
pdns/recursordist/ws-recursor.cc
pdns/webserver.cc
pdns/webserver.hh
pdns/ws-auth.cc

index aae2ba21bc2b860aa3bf295147d488b8300cda1d..d38be36ca09b9ade64f0aa5600a9a84800e35655 100644 (file)
@@ -2255,16 +2255,16 @@ Ignored if ``webserver-address`` is set to a UNIX domain socket.
 
 If the webserver should print arguments.
 
-.. _setting-webserver-allow-cross-origin-requests:
+.. _setting-webserver-cross-origin-request-header:
 
-``webserver-allow-cross-origin-requests``
+``webserver-cross-origin-request_header``
 -----------------------------------------
 .. versionadded:: 5.1.0
 
 -  String
 -  Default: empty
 
-The value if the access-control-allow-origin HTTP header to include. This header is not inluded if the value is empty.
+The value if the access-control-allow-origin HTTP header to include. This header is not included if the value is empty.
 
 .. _setting-write-pid:
 
index 70ff457015d7603b445627f7d239737be0d9eb37..80c0725a988da0e8f8c9a2997b5f2acd03917961 100644 (file)
@@ -15,7 +15,7 @@ Cross origin requests
 ^^^^^^^^^^^^^^^^^^^^^
 
 The embedded webserver now does not include a ``access-control-allow-origin: *`` header by default.
-See :ref:`setting-webserver-allow-cross-origin-requests`.
+See :ref:`setting-webserver-cross-origin-request-header`.
 
 zone display
 ^^^^^^^^^^^^
index fd56d6e6caffe3b7792849047aefef01660f3e8e..fb084c0af42ea5687d861db7ce985f492ced8ccb 100644 (file)
@@ -255,7 +255,7 @@ static void declareArguments()
   ::arg().set("webserver-max-concurrent-connections", "Webserver/API maximum concurrent connections allowed") = "100";
   ::arg().set("webserver-connection-timeout", "Webserver/API request/response timeout in seconds") = "5";
   ::arg().setSwitch("webserver-hash-plaintext-credentials", "Whether to hash passwords and api keys supplied in plaintext, to prevent keeping the plaintext version in memory at runtime") = "no";
-  ::arg().set("webserver-allow-cross-origin-requests", "Webserver cross origin request header value") = "";
+  ::arg().set("webserver-cross-origin-request_header", "Webserver cross origin request header value") = "";
 
   ::arg().setSwitch("query-logging", "Hint backends that queries should be logged") = "no";
 
index d16352ab4f1107b45eed8b6eaa8c26bdeab65550..7d37513ecd4455d75be5c8ecc7a16b26a3c61bd3 100644 (file)
@@ -22,7 +22,7 @@ New settings
 - The :ref:`setting-yaml-outgoing.max_bytesperq` setting has been introduced to limit the amount of incoming bytes per client query.
 - The :ref:`setting-yaml-recordcache.max_entry_size` setting has been introduced to limit the maximum size of a stored record set.
 - The :ref:`setting-yaml-packetcache.max_entry_size` setting has been introduced to limit the maximum size of a packet cache entry.
-- The :ref:`setting-yaml-webservice.allow_cross_origin_requests` setting has been introduced, default is not set. This is a change of behaviour, as older versions do set the access-control-allow-origin header.
+- The :ref:`setting-yaml-webservice.cross_origin_request_header` setting has been introduced, default is not set. This is a change of behaviour, as older versions do set the access-control-allow-origin header.
 
 
 5.3.0 to 5.4.0
index 9c49b5b4611c0a8c2271fe6df3f194a09c5d6d7e..0de9e0d0cf336a7f01d2ded3eeaba064e7e6d6b3 100644 (file)
@@ -176,8 +176,8 @@ fn api_wrapper(
     allow_password: bool,
 ) {
     // security headers
-    if !ctx.allow_cross_origin_requests.is_empty()  {
-        if let Ok(value) = header::HeaderValue::from_str(&ctx.allow_cross_origin_requests) {
+    if !ctx.cross_origin_request_header.is_empty()  {
+        if let Ok(value) = header::HeaderValue::from_str(&ctx.cross_origin_request_header) {
             headers.insert(
                 header::ACCESS_CONTROL_ALLOW_ORIGIN,
                 value,
@@ -284,7 +284,7 @@ struct Context {
     logger: cxx::SharedPtr<rustmisc::Logger>,
     loglevel: rustmisc::LogLevel,
     max_request_size: u64,
-    allow_cross_origin_requests: String,
+    cross_origin_request_header: String,
 }
 
 // Serve a file
@@ -460,10 +460,10 @@ fn collect_options(
     response.status = 200;
     methods.push(Method::OPTIONS.to_string());
 
-    if !ctx.allow_cross_origin_requests.is_empty() {
+    if !ctx.cross_origin_request_header.is_empty() {
         response.headers.push(rustweb::KeyValue {
             key: String::from("access-control-allow-origin"),
-            value: String::from(ctx.allow_cross_origin_requests.clone()),
+            value: String::from(ctx.cross_origin_request_header.clone()),
         });
     }
 
@@ -951,7 +951,7 @@ pub fn serveweb(
     logger: cxx::SharedPtr<rustmisc::Logger>,
     loglevel: rustmisc::LogLevel,
     max_request_size: u64,
-    allow_cross_origin_requests: String,
+    cross_origin_request_header: String,
 ) -> Result<(), std::io::Error> {
     // Context, atomically reference counted
     let ctx = Arc::new(Context {
@@ -961,7 +961,7 @@ pub fn serveweb(
         logger,
         loglevel,
         max_request_size,
-        allow_cross_origin_requests,
+        cross_origin_request_header,
     });
 
     // We use a single thread to handle all the requests, letting the runtime abstracts from this
@@ -1262,7 +1262,7 @@ mod rustweb {
             logger: SharedPtr<Logger>,
             loglevel: LogLevel,
             max_request_size: u64,
-            allow_cross_origin_requests: String,
+            cross_origin_request_header: String,
         ) -> Result<()>;
     }
 
index e202369d0accc7e370d09bbb15ea3fd9caa6901e..24673130e6fe5828dfdf8c600c039799cc67066d 100644 (file)
@@ -276,7 +276,7 @@ Static pre-shared authentication key for access to the REST API. Since 4.6.0 the
         "versionchanged": ("4.6.0", "This setting now accepts a hashed and salted version."),
     },
     {
-        "name": "allow_cross_origin_requests",
+        "name": "cross_origin_request_heaer",
         "section": "webservice",
         "type": LType.String,
         "default": "",
index bfb629d3d1d65ff6719275c3b1fe36c8db3b7825..14050ee66708e84e750b5843fff01351f86da724 100644 (file)
@@ -1203,7 +1203,7 @@ void serveRustWeb()
   // This function returns after having created the web server object that handles the requests.
   // That object and its runtime are associated with a Posix thread that waits until all tasks are
   // done, which normally never happens. See rec-rust-lib/rust/src/web.rs for details
-  pdns::rust::web::rec::serveweb(config, std::move(password), std::move(apikey), std::move(aclPtr), std::move(logPtr), loglevel, arg().asNum("webserver-max-request-size") * 1024ULL * 1024ULL, arg()["allow-cross-origin-requests"]);
+  pdns::rust::web::rec::serveweb(config, std::move(password), std::move(apikey), std::move(aclPtr), std::move(logPtr), loglevel, arg().asNum("webserver-max-request-size") * 1024ULL * 1024ULL, arg()["cross-origin-request-header"]);
 }
 
 static void fromCxxToRust(const HttpResponse& cxxresp, pdns::rust::web::rec::Response& rustResponse)
index 2666334a52dfdc2bb40889dea98ef58069087a02..d703da5b478ab57b65d0a347ee287db2398d0b89 100644 (file)
@@ -147,8 +147,8 @@ void WebServer::registerBareHandler(const string& url, const HandlerFunction& ha
 
 void WebServer::apiWrapper(const WebServer::HandlerFunction& handler, HttpRequest* req, HttpResponse* resp, bool allowPassword)
 {
-  if (!d_allow_cross_origin_requests.empty()) {
-    resp->headers["access-control-allow-origin"] = d_allow_cross_origin_requests;
+  if (!d_cross_origin_request_header.empty()) {
+    resp->headers["access-control-allow-origin"] = d_cross_origin_request_header;
   }
 
   if (!d_apikey) {
@@ -607,7 +607,7 @@ WebServer::WebServer(std::shared_ptr<ConcurrentConnectionManager> ccm, string li
   d_maxbodysize(static_cast<ssize_t>(2 * 1024 * 1024))
 
 {
-    YaHTTP::Router::Map("OPTIONS", "/<*url>", [&allowCors = d_allow_cross_origin_requests](YaHTTP::Request *req, YaHTTP::Response *resp) {
+    YaHTTP::Router::Map("OPTIONS", "/<*url>", [&allowCors = d_cross_origin_request_header](YaHTTP::Request *req, YaHTTP::Response *resp) {
       // look for url in routes
       bool seen = false;
       std::vector<std::string> methods;
index ef299a7593d1a6e2710eeac150ab87849062db92..f03550d8b020fd33e807f454557e1ef1fd649a97 100644 (file)
@@ -284,9 +284,9 @@ public:
     return d_loglevel;
   };
 
-  void setAllowCrossOriginRequests(const std::string& value)
+  void setCrossOriginRequestHeader(const std::string& value)
   {
-    d_allow_cross_origin_requests = value;
+    d_cross_origin_request_header = value;
   }
 
   std::shared_ptr<Logr::Logger> d_slog;
@@ -315,7 +315,7 @@ protected:
   int d_connectiontimeout{5}; // in seconds
 
   NetmaskGroup d_acl;
-  std::string d_allow_cross_origin_requests;
+  std::string d_cross_origin_request_header;
 
   const string d_logprefix = "[webserver] ";
 
index 92170b5e036f8a9c58125d91d03f682f3abdd0b5..15bab2f928b174b9dfe9beeded4881e2a34530d8 100644 (file)
@@ -116,7 +116,7 @@ AuthWebServer::AuthWebServer() :
     d_ws->setMaxBodySize(::arg().asNum("webserver-max-bodysize"));
     d_ws->setConnectionTimeout(::arg().asNum("webserver-connection-timeout"));
 
-    d_ws->setAllowCrossOriginRequests(arg()["webserver-allow-cross-origin-requests"]);
+    d_ws->setCrossOriginRequestHeader(arg()["webserver-cross-origin-request-header"]);
     d_ws->bind();
   }
 }