Skip to content

Instantly share code, notes, and snippets.

@questionlp
Last active January 30, 2025 07:06
Show Gist options
  • Save questionlp/07ad5a8a3f68340fda8aaf8fd100312c to your computer and use it in GitHub Desktop.
Save questionlp/07ad5a8a3f68340fda8aaf8fd100312c to your computer and use it in GitHub Desktop.
Simple RFC 2324 Implementation in NGINX

Simple RFC 2324 Implementation in NGINX

server {
  # Usual site configuration stuff here
  
  location / {
    # Add any other configuration for the main location here
    
    if ($request_method = BREW) {
      set $teapot 1;
    }

    if ($content_type = "application/coffee-pot-command") {
      set $teapot "${teapot}1";
    }

    if ($teapot = 11) {
      return 418 "I'm a teapot.";
    }
  }
  
  # More usual site configuration here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment