Skip to content

Commit

Permalink
don't check referer on xml and txt files
Browse files Browse the repository at this point in the history
Yandex manual checks of goods feeds otherwise sometimes yield 403s.
  • Loading branch information
paskal committed Dec 18, 2023
1 parent c055f93 commit 13562d2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion config/nginx/bitrix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ location ~ ^/sitemap.*\.xml$ {
rewrite "/(sitemap.*)\.xml" /aspro_regions/sitemap/$1_$host.xml break;
}

location ~* ^.+\.(xml|txt|jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|map|js|json|htm|ttf|otf|webp|woff2?|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2?|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpe?g|wmv|exe|iso|dmg|swf|webmanifest)$ {
# all static locations except for txt and xml, with invalid referer check
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|map|js|json|htm|ttf|otf|webp|woff2?|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2?|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpe?g|wmv|exe|iso|dmg|swf|webmanifest)$ {
error_page 404 /404.html;
log_not_found off;
access_log off;
Expand All @@ -87,6 +88,16 @@ location ~* ^.+\.(xml|txt|jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|map|js|json|
}
}

# xml and txt static location, without referer check
location ~* ^.+\.(xml|txt)$ {
error_page 404 /404.html;
log_not_found off;
access_log off;
expires max;
add_header Cache-Control public;
include security_headers.conf;
}

# Disable access for non-static assets in cache location
location ~* ^/bitrix/cache { deny all; }

Expand Down

0 comments on commit 13562d2

Please sign in to comment.