forked from cgerard321/champlain_petclinic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
120 lines (93 loc) · 3.43 KB
/
nginx.conf
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
load_module modules/ngx_http_js_module.so;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
js_import njs/owners.js;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
resolver 127.0.0.11; # Default Docker embedded DNS IP
set $auth_origin "http://auth:8080";
set $customers_origin "http://customers:8080";
set $visits_origin "http://visits:8080";
set $vets_origin "http://vets:8080";
set $bills_origin "http://billing:8080";
location /auth {
internal;
proxy_method HEAD;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_pass $auth_origin/users;
}
location /login {
proxy_pass $auth_origin/users/login;
}
location = /proxy/owners {
internal;
proxy_pass $customers_origin/owners;
}
location ~ ^/proxy/owners/(.*)$ {
internal;
proxy_pass $customers_origin/owners/$1;
}
location ~ /proxy/visits(.*) {
internal;
proxy_pass $visits_origin/visits$1;
}
location /api/gateway/ {
proxy_intercept_errors on;
error_page 403 = @Forbidden;
auth_request /auth;
auth_request_set $auth_status $upstream_status;
location ~ ^/api/gateway/owners/pets/(.*)$ {
proxy_pass $visits_origin/owners/literallyanything/pets/$1;
}
location ~ ^/api/gateway/owners/?$ {
js_content owners.aggregation;
}
location ~ ^/api/gateway/owners/([^/]+)$ {
js_content owners.singleAggregation;
}
location ~ /api/gateway/owners(.*) {
proxy_pass $customers_origin/owners/$1;
}
location ~ ^/api/gateway/visits/([^/]+)/owners/pets/([^/]+)$ {
proxy_pass $visits_origin/owners/literallyanything/pets/$2/visits/$1;
}
# Guess I'll fix it for you... Thank you VISITS team 😞
location ~ ^/api/gateway/visits/pet/([^/]+)$ {
proxy_pass $visits_origin/visits/$1;
}
location = /api/gateway/visits/pets {
proxy_pass $visits_origin/pets/visits$is_args$args;
}
location ~ ^/api/gateway/visits/([^/]+)$ {
proxy_pass $visits_origin/visit/$1;
}
location ~ ^/api/gateway/visits(.*) {
proxy_pass $visits_origin/visits$1;
}
location ~ /api/gateway/pets(.*) {
proxy_pass $visits_origin/pets$1$is_args$args;
}
location ~ /api/gateway/vets(.*) {
proxy_pass $vets_origin/vets$1;
}
location ~ /api/gateway/bills(.*) {
proxy_pass $bills_origin/bills$1;
}
return 404 '{"statusCode": 404, "message": "Not found", "timestamp": "$time_iso8601"}';
}
location @Forbidden {
default_type application/json;
return 403 '{"statusCode": 403, "message": "Forbidden", "timestamp": "$time_iso8601"}';
}
}
}