Skip to content

Commit 2505fd7

Browse files
feat: server/main.cpp: add sp API to example.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
1 parent 31ddfc8 commit 2505fd7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

example/server/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ int server_main( int argc, char* argv[] )
8787
options.set(http_proto::x_download_options(http_proto::helmet_download_type::noopen));
8888
options.set(http_proto::x_frame_origin(http_proto::helmet_origin_type::deny));
8989

90+
std::vector<std::string> allow_list;
91+
92+
http_proto::sp::append(allow_list, "script-src", http_proto::sp::allow_type::self);
93+
http_proto::sp::append(allow_list, "object-src", http_proto::sp::allow_type::none);
94+
95+
options.set(http_proto::content_security_policy(allow_list));
96+
9097
srv.wwwroot.use(
9198
http_proto::helmet(options),
9299
[] ( http_proto::route_params& ) ->

0 commit comments

Comments
 (0)