-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
638 additions
and
443 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
.flake8 | ||
.*ignore | ||
*.db | ||
*.egg-info |
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
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,92 @@ | ||
worker_processes auto; | ||
error_log stderr warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
accept_mutex on; | ||
} | ||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
gzip on; | ||
keepalive_timeout 5; | ||
|
||
log_format main '[$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
access_log /dev/stdout main; | ||
|
||
upstream app_server { | ||
# fail_timeout=0 means we always retry an upstream even if it failed | ||
# to return a good HTTP response | ||
server unix:/home/calitp/run/gunicorn.sock fail_timeout=0; | ||
} | ||
|
||
# maps $binary_ip_address to $limit variable if request is of type POST | ||
map $request_method $limit { | ||
default ""; | ||
POST $binary_remote_addr; | ||
} | ||
|
||
# define a zone with 10mb memory, rate limit to 12 requests/min (~= 1 request/5 seconds) on applied locations | ||
# $limit will eval to $binary_remote_addr for POST requests using the above map | ||
# requests with an empty key value (e.g. GET) are not affected | ||
# http://nginx.org/en/docs/http/ngx_http_limit_req_module.html#limit_req_zone | ||
limit_req_zone $limit zone=rate_limit:10m rate=12r/m; | ||
|
||
server { | ||
listen 8000; | ||
|
||
keepalive_timeout 65; | ||
|
||
# 404 known scraping path targets | ||
# case-insensitive regex matches the given path fragment anywhere in the request path | ||
location ~* /(\.?git|api|app|assets|ats|bootstrap|bower|cgi|content|credentials|docker|doc|env|example|swagger|web) { | ||
access_log off; | ||
log_not_found off; | ||
return 404; | ||
} | ||
|
||
# 404 known scraping file targets | ||
# case-insensitive regex matches the given file extension anywhere in the request path | ||
location ~* /.*\.(asp|axd|cgi|com|env|json|php|xml|ya?ml) { | ||
access_log off; | ||
log_not_found off; | ||
return 404; | ||
} | ||
|
||
location /favicon.ico { | ||
access_log off; | ||
log_not_found off; | ||
expires 1y; | ||
add_header Cache-Control public; | ||
} | ||
|
||
# path for static files | ||
location /static/ { | ||
alias /home/calitp/app/static/; | ||
expires 1y; | ||
add_header Cache-Control public; | ||
} | ||
|
||
location / { | ||
# checks for static file, if not found proxy to app | ||
try_files $uri @proxy_to_app; | ||
} | ||
|
||
# apply rate limit to these paths | ||
# case-insensitive regex matches path | ||
location ~* ^/(eligibility/confirm)$ { | ||
limit_req zone=rate_limit; | ||
include /home/calitp/run/proxy.conf; | ||
} | ||
|
||
# app path | ||
location @proxy_to_app { | ||
include /home/calitp/run/proxy.conf; | ||
} | ||
} | ||
} |
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 @@ | ||
# the core app proxy directives | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header Host $http_host; | ||
# we don't want nginx trying to do something clever with | ||
# redirects, we set the Host: header above already. | ||
proxy_redirect off; | ||
proxy_pass http://app_server; |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
__version__ = "2023.04.1" | ||
__version__ = "2023.04.2" | ||
|
||
VERSION = __version__ |
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
Oops, something went wrong.