blob: 30401e70f004a504bad608f1ffb9859ff7ba412d [file] [log] [blame]
#/*
# * Licensed to the Apache Software Foundation (ASF) under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The ASF licenses this file to You under the Apache License, Version 2.0
# * (the "License"); you may not use this file except in compliance with
# * the License. You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# */
location / {
root /etc/api-gateway/html;
index index.html index.htm;
}
location /health-check {
access_log off;
default_type application/json;
content_by_lua_block {
local cjson = require "cjson"
local s = {}
s.status = "API-Gateway is running"
if jit then
s.lua_version = jit.version
else
s.lua_version = "LuaJIT is not enabled"
end
local config_status = ngx.location.capture("/config-status");
if (config_status) then
s.config = cjson.decode(config_status.body)
end
ngx.say(cjson.encode(s))
}
}
location /config-status {
access_log off;
proxy_pass http://127.0.0.1:8888/health-check;
}
error_page 500 501 502 503 504 /50x.html;
location /50x.html {
more_set_headers 'Content-Type: application/json';
return 500 '{"code":$status, "message":"Oops. Something went wrong. Check your URI and try again."}\n';
}