-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from statsig-io/10-29-updates_for_version_2.0.0
Updates for version 2.0.0
- Loading branch information
Showing
14 changed files
with
329 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Start Nginx in the background, redirecting output to /dev/null | ||
nginx -g 'daemon off; error_log /dev/stderr error;' > /dev/null 2>&1 & | ||
|
||
# Execute the main application | ||
exec statsig_forward_proxy "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
worker_processes auto; | ||
worker_cpu_affinity auto; | ||
|
||
events { | ||
worker_connections 1024; | ||
multi_accept on; | ||
use epoll; | ||
} | ||
|
||
http { | ||
proxy_cache_path /dev/shm/nginx levels=1:2 keys_zone=download_cache:10m max_size=1024m inactive=1m use_temp_path=off; | ||
|
||
server { | ||
listen 8000; | ||
server_name localhost; | ||
|
||
# Disable caching for /v1/log_event | ||
location /v1/log_event { | ||
proxy_pass http://127.0.0.1:8001; | ||
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; | ||
|
||
# Disable caching for this location | ||
proxy_cache off; | ||
} | ||
|
||
# Cache everything else | ||
location / { | ||
proxy_pass http://127.0.0.1:8001; | ||
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; | ||
|
||
# Enable caching | ||
proxy_cache download_cache; | ||
proxy_cache_methods GET POST; | ||
proxy_cache_key "$request_method$request_uri$http_statsig_api_key$http_accept_encoding$request_body"; | ||
proxy_cache_use_stale updating error timeout http_500 http_502 http_503 http_504; | ||
proxy_cache_background_update on; | ||
proxy_cache_valid 200 5s; | ||
proxy_cache_lock on; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
pub mod disabled_cache; | ||
pub mod in_memory_cache; | ||
pub mod redis_cache; |
Oops, something went wrong.