forked from Kong/kong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kong.yml
160 lines (127 loc) · 3.57 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
# Available plugins on this server
plugins_available:
- keyauth
- basicauth
- ratelimiting
- tcplog
- udplog
- filelog
- cors
- request_transformer
nginx_working_dir: /usr/local/kong/
proxy_port: 8000
admin_api_port: 8001
# Specify the DAO to use
database: cassandra
# Databases configuration
databases_available:
cassandra:
properties:
hosts: "localhost"
port: 9042
timeout: 1000
keyspace: kong
keepalive: 60000 # in milliseconds
# Cassandra cache configuration
database_cache_expiration: 5 # in seconds
# Sends anonymous error reports
send_anonymous_reports: true
# Nginx configuration
nginx: |
worker_processes auto;
error_log logs/error.log info;
daemon on;
worker_rlimit_nofile {{auto_worker_rlimit_nofile}};
env KONG_CONF;
events {
worker_connections {{auto_worker_connections}};
multi_accept on;
}
http {
resolver 8.8.8.8;
charset UTF-8;
access_log logs/access.log;
access_log on;
# Timeouts
keepalive_timeout 60s;
client_header_timeout 60s;
client_body_timeout 60s;
send_timeout 60s;
# Proxy Settings
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_ssl_server_name on;
# IP Address
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
real_ip_recursive on;
# Other Settings
client_max_body_size 128m;
underscores_in_headers on;
reset_timedout_connection on;
tcp_nopush on;
################################################
# The following code is required to run Kong #
# Please be careful if you'd like to change it #
################################################
# Lua Settings
lua_package_path ';;';
lua_code_cache on;
lua_max_running_timers 4096;
lua_max_pending_timers 16384;
lua_shared_dict cache 512m;
lua_socket_log_errors off;
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 {{proxy_port}};
location / {
default_type 'text/plain';
# This property will be used later by proxy_pass
set $backend_url 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;
proxy_pass_header Server;
# 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()';
}
location /robots.txt {
return 200 'User-agent: *\nDisallow: /';
}
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 {{admin_api_port}};
location / {
default_type application/json;
content_by_lua 'require("lapis").serve("kong.api.app")';
}
location /robots.txt {
return 200 'User-agent: *\nDisallow: /';
}
# Do not remove, additional configuration placeholder for some plugins
# {{additional_configuration}}
}
}