Skip to content

Commit

Permalink
global: disable etag validation in nginx
Browse files Browse the repository at this point in the history
Signed-off-by: Parth Shandilya <parth.shandilya@cern.ch>
  • Loading branch information
ParthS007 authored and pamfilos committed Jul 19, 2023
1 parent a173d84 commit 7201ffc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docker/nginxdev/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ server {
return 301 https://$host$request_uri;
}

# Map for headers to avoid caching
map "$request_method:$uri" $none_match {
"~*^GET:/api/records" "";
default "-";
}

map "$request_method:$uri" $modified_since {
"~*^GET:/api/records" "";
default "-";
}

# HTTPS server
server {
listen 443 ssl; # IPv4
Expand Down Expand Up @@ -87,6 +98,23 @@ server {

proxy_pass http://nodeweb;
}

location /api/records {
# Gets the headers from the map for GET requests
proxy_set_header If-None-Match $none_match;
proxy_set_header If-Modified-Since $modified_since;

rewrite ^/api/(.*) /$1 break;
proxy_set_header Host $http_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;
proxy_pass http://api_server;

# Max upload size (except for files) is set to 100mb as default.
client_max_body_size 100m;
}

location /api {
rewrite ^/api/(.*) /$1 break ;
proxy_set_header Host $http_host;
Expand Down

0 comments on commit 7201ffc

Please sign in to comment.