Skip to content

Commit

Permalink
Add nginx headers more
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkbatya committed Oct 2, 2023
1 parent 3f4336f commit 8b2544b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__
.swp
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-alpine3.17
FROM flipperdevices/nginx-headers-more-alpine:1.25.1

WORKDIR /app

Expand Down
17 changes: 14 additions & 3 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ user nginx;
worker_processes 1;
daemon off;

error_log /dev/stdout info;
error_log /dev/stdout warn;
pid /var/run/nginx.pid;
load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so;

events {
worker_connections 1024;
Expand All @@ -12,19 +13,29 @@ events {
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
keepalive_timeout 65;
underscores_in_headers on;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'host="$http_host"';
access_log /dev/stdout main;
keepalive_timeout 300;
root /static;
server {
listen 80 default_server;
location /webhook {
proxy_pass http://127.0.0.1:5000;
more_set_headers 'Cache-Control: no-cache, max-age=0, s-max-age=0, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0';
}
location = / {
index index.html;
more_set_headers -s '200 201 204 206 301 302 303 304 307 308' 'Cache-Control: public, max-age=14400, s-max-age=14400';
more_set_headers -s '400 404 413 500 503' 'Cache-Control: no-cache, max-age=0, s-max-age=0, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0';
}
location / {
try_files $uri $uri.html $uri/ =404;
more_set_headers -s '200 201 204 206 301 302 303 304 307 308' 'Cache-Control: public, max-age=14400, s-max-age=14400';
more_set_headers -s '400 404 413 500 503' 'Cache-Control: no-cache, max-age=0, s-max-age=0, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0';
}
}
}

0 comments on commit 8b2544b

Please sign in to comment.