mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-13 01:36:22 +00:00
41 lines
949 B
Plaintext
41 lines
949 B
Plaintext
location /_static/ {
|
|
|
|
# use our custom request limit and allow bursts
|
|
limit_req zone=customstappslimit burst=20 nodelay;
|
|
|
|
{{{ cors }}}
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
{{{ cors }}}
|
|
add_header 'Content-Length' '0';
|
|
return 204;
|
|
}
|
|
alias /static/;
|
|
expires 7d;
|
|
## Check for file existing and if there, stop ##
|
|
if (-f $request_filename) {
|
|
break;
|
|
}
|
|
## Check for file existing and if there, stop ##
|
|
if (-d $request_filename) {
|
|
break;
|
|
}
|
|
##Check for png
|
|
if (-e $request_filename.png) {
|
|
rewrite ^/(.*)$ /$1.png;
|
|
break;
|
|
}
|
|
##Check for gif
|
|
if (-e $request_filename.gif) {
|
|
rewrite ^/(.*)$ /$1.gif;
|
|
break;
|
|
}
|
|
##Check for jpg
|
|
if (-e $request_filename.jpg) {
|
|
rewrite ^/(.*)$ /$1.jpg;
|
|
break;
|
|
}
|
|
##Fallback rule if no match is found
|
|
rewrite ^/(.*/).*(small|medium|large|thumbnail)$ /$1default-$2.png;
|
|
}
|