-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
39 lines (28 loc) · 1.06 KB
/
nginx.conf
File metadata and controls
39 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
worker_rlimit_core 500M; #to allow core dump logging and viewing
working_directory /process_logs/nginx; #to allow core dump logging
events {
worker_connections 1024;
}
http {
upstream hackoregon {
postgres_server 127.0.0.1 dbname=hackoregon user=postgres password=points;
}
server {
listen 80;
location ~ "/(?<db>\w+)/(?<schema>\w+)/(?<function>\w+)(?<path>/.*){0,}$" {
add_header Access-Control-Allow-Origin *; # < this is the needed header to allow access from any server
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET';
postgres_escape $user $remote_user;
postgres_output text;
postgres_pass $db;
postgres_query HEAD GET "SELECT * FROM http.get('$schema', '$function', '$path', '$user')";
}
}
}