server {
    # listen ip6 addresses
	listen [::]:443 ssl http2 so_keepalive=on;

    # your server domain name in CDN, for instance myserver.example.com
    server_name server_domain_name;

    # fallback: proxy_pass redirects request to another server
    location / {
        proxy_pass https://duckduckgo.com;
    }


    # path to certificates (self-signed or from Cloudflare)
	ssl_certificate /etc/ssl/certs/cert.pem;
	ssl_certificate_key /etc/ssl/private/cert.key;

	
	client_header_timeout 52w;
    keepalive_timeout 52w;
	# secret location; should match that in the xray server config
    location /your_service_name {
		if ($content_type !~ "application/grpc") {
            # redirect to the root location
			return 302 /;
		}
		client_max_body_size 0;
		client_body_buffer_size 512k;
		grpc_set_header X-Real-IP $remote_addr;
		client_body_timeout 52w;
		grpc_read_timeout 52w;
        # connect to xray on localhost
		grpc_pass grpc://127.0.0.1:50051;
	}
}
