about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--modules/obsidian-livesync.nix13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/obsidian-livesync.nix b/modules/obsidian-livesync.nix
index 7bbde9d..075c40a 100644
--- a/modules/obsidian-livesync.nix
+++ b/modules/obsidian-livesync.nix
@@ -42,10 +42,15 @@ in
 				locations."/" = {
 					proxyPass = "http://127.0.0.1:${toString couchdb-port}";
 			        	extraConfig = ''
-					 	proxy_set_header Host "$host";
-					 	proxy_set_header X-Real-IP "$remote_addr";
-					 	proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
-					 	proxy_set_header X-Forwarded-Proto "$scheme";
+						proxy_set_header Host "$host";
+						proxy_set_header X-Real-IP "$remote_addr";
+						proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
+						proxy_set_header X-Forwarded-Proto "$scheme";
+					        add_header Access-Control-Allow-Origin "app://obsidian.md";
+						add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
+						add_header Access-Control-Allow-Headers "Content-Type, Authorization";
+						add_header Access-Control-Allow-Credentials "true";
+						add_header Access-Control-Max-Age 86400
 					'';
 				};
 			};