-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
39 lines (36 loc) · 897 Bytes
/
Copy pathnginx.conf
File metadata and controls
39 lines (36 loc) · 897 Bytes
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
38
39
events {
worker_connections 1024;
}
http {
upstream postgrest {
server rest:3000;
}
limit_req_zone $binary_remote_addr zone=like:5m rate=1r/s;
server {
location /api/ {
default_type application/json;
proxy_hide_header Content-Location;
add_header Content-Location /api/$upstream_http_content_location;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://postgrest/;
}
location /rpc/ {
proxy_pass http://postgrest/rpc/;
}
location /rpc/like {
limit_req zone=like burst=5;
proxy_pass http://postgrest/rpc/like;
}
location /analytics {
proxy_pass http://postgrest/analytics;
}
# /post/:id -> /rpc/post?id=:id
location /post/ {
rewrite ^/post/(\d+)$ /rpc/post?id=$1 last;
}
location = / {
proxy_pass http://postgrest/rpc/index;
}
}
}