teableio/teable

View on GitHub
dockers/examples/docker-swarm/gateway/conf.d/default.conf

Summary

Maintainability
Test Coverage
log_format json_log escape=json '{'
    '"timestamp":"$time_iso8601",'
    '"remote_addr":"$remote_addr",'
    '"remote_user":"$remote_user",'
    '"request_method":"$request_method",'
    '"request_uri":"$request_uri",'
    '"protocol":"$server_protocol",'
    '"status":$status,'
    '"body_bytes_sent":$body_bytes_sent,'
    '"request_time":$request_time,'
    '"http_referrer":"$http_referer",'
    '"http_user_agent":"$http_user_agent",'
    '"http_x_forwarded_for":"$http_x_forwarded_for",'
    '"upstream_addr":"$upstream_addr",'
    '"upstream_status":"$upstream_status",'
    '"upstream_response_time":"$upstream_response_time",'
    '"server_name":"$server_name",'
    '"http_host":"$host"'
'}';

access_log  /dev/stdout json_log;
server_tokens off;

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

upstream teable {
    server  teable:3000;
}

server {
    server_name localhost;
    listen 80;
    listen [::]:80;

    location / {
        proxy_pass http://teable;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }

    location /healthcheck {
        default_type application/json;
        access_log off;
        return 200 '{"status":"ok"}';
    }
}