-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkong.yml
162 lines (128 loc) · 3.29 KB
/
kong.yml
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Available plugins on this server
plugins_available:
- queryauth
- headerauth
- basicauth
- ratelimiting
- tcplog
- udplog
- filelog
# Uncomment the following line to setup a custom output directory
# output: /var/log/kong
# Specify the DAO to use
database: cassandra
# Databases configuration
databases_available:
cassandra:
properties:
hosts: localhost
port: 9042
timeout: 1000
keyspace: kong
keepalive: 60000
# Sends anonymous error reports
send_anonymous_reports: true
# Cache configuration
cache:
expiration: 5 # In seconds
nginx: |
worker_processes auto;
error_log logs/error.log info;
worker_rlimit_nofile 84280;
daemon on;
pid nginx.pid;
env KONG_CONF;
env KONG_HOME;
events {
worker_connections 20480;
}
http {
lua_package_path ';;';
lua_code_cache on;
access_log logs/access.log;
underscores_in_headers on;
access_log on;
tcp_nopush on;
# Timeouts
keepalive_timeout 60s;
client_header_timeout 60s;
client_body_timeout 60s;
send_timeout 60s;
reset_timedout_connection on;
# Max Client request size
client_max_body_size 50m;
# Proxy buffers
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
# Proxy SSL
proxy_ssl_server_name on;
# Timer properties
lua_max_running_timers 4096;
lua_max_pending_timers 16384;
# Cache
lua_shared_dict cache 512m;
# Generic Settings
resolver 8.8.8.8;
charset UTF-8;
init_by_lua '
kong = require "kong"
local status, err = pcall(kong.init)
if not status then
ngx.log(ngx.ERR, "Startup error: "..err)
os.exit(1)
end
';
server {
listen 8000;
location /robots.txt {
return 200 'User-agent: *\nDisallow: /';
}
location / {
# Assigns the default MIME-type to be used for files where the
# standard MIME map doesn't specify anything.
default_type 'text/plain';
# This property will be used later by proxy_pass
set $backend_url nil;
set $querystring nil;
# Authenticate the user and load the API info
access_by_lua 'kong.exec_plugins_access()';
# Proxy the request
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass $backend_url;
# Add additional response headers
header_filter_by_lua 'kong.exec_plugins_header_filter()';
# Change the response body
body_filter_by_lua 'kong.exec_plugins_body_filter()';
# Log the request
log_by_lua 'kong.exec_plugins_log()';
}
error_page 500 /500.html;
location = /500.html {
internal;
content_by_lua '
local utils = require "kong.tools.utils"
utils.show_error(ngx.status, "Oops, an unexpected error occurred!")
';
}
}
server {
listen 8001;
location / {
default_type application/json;
content_by_lua '
require("lapis").serve("kong.web.app")
';
}
location /static/ {
alias static/;
}
location /admin/ {
alias admin/;
}
location /favicon.ico {
alias static/favicon.ico;
}
}
}