Skip to content

Instantly share code, notes, and snippets.

@KunalSin9h
Last active May 20, 2024 07:15
Show Gist options
  • Save KunalSin9h/4dce3a8ae17980a16eae0b9fc3c0e238 to your computer and use it in GitHub Desktop.
Save KunalSin9h/4dce3a8ae17980a16eae0b9fc3c0e238 to your computer and use it in GitHub Desktop.
server {
    server_name your_domain www.your_domain;
    
    client_max_body_size 20M;

    location / {
        proxy_pass http://localhost:9990;
    }
}
@KunalSin9h
Copy link
Author

Disable Request and Response Buffering

Tip

Helpful in Server Sent Event like Event Stream.

Response Buffering:

server {
  location / {
    proxy_buffering off;
  }
}

Request Buffering:

server {
   proxy_request_buffering off; 
   client_body_buffer_size 0;
   proxy_max_temp_file_size 0;
}

@KunalSin9h
Copy link
Author

Proxy Set Headers

proxy_set_header Host $http_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_http_version 1.1;
proxy_pass http://unix:/run/gosvc/SERVICE.sock:/URL;
proxy_redirect default;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment