http { # ... other http configurations ... map $http_authorization $is_s3_auth { default 0; ~AWS4-HMAC-SHA256 1; # Check for AWS S3 v4 authorization } server { listen 80; # Or your desired port server_name yourdomain.com; # Or your domain location / { if ($request_method = PUT) { if ($is_s3_auth = 1) { # PUT request with S3 authorization: proxy to s3_backend proxy_pass http://s3_backend; break; # Stop further processing in this location } } # All other requests (or PUT without S3 auth): proxy to default_backend proxy_pass http://default_backend; } # ... other locations ... } # ... other http configurations ... }