浏览代码

Add Access-Control-Allow-Credentials header in normal replay

Only when really configured
Sergey Linev 2 年之前
父节点
当前提交
4442d645a0
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/civetweb.c

+ 7 - 0
src/civetweb.c

@@ -15024,6 +15024,13 @@ handle_request(struct mg_connection *conn)
 			          ((cors_meth_cfg[0] == '*') ? cors_acrm : cors_meth_cfg),
 			          ((cors_meth_cfg[0] == '*') ? cors_acrm : cors_meth_cfg),
 			          suggest_connection_header(conn));
 			          suggest_connection_header(conn));
 
 
+			const char *cors_cred_cfg =
+			      conn->dom_ctx->config[ACCESS_CONTROL_ALLOW_CREDENTIALS];
+			if (cors_cred_cfg && *cors_cred_cfg)
+			   mg_printf(conn,
+			             "Access-Control-Allow-Credentials: %s\r\n",
+			             cors_cred_cfg);
+
 			if (cors_acrh != NULL) {
 			if (cors_acrh != NULL) {
 				/* CORS request is asking for additional headers */
 				/* CORS request is asking for additional headers */
 				const char *cors_hdr_cfg =
 				const char *cors_hdr_cfg =