Skip to content

Commit c36f52a

Browse files
committed
export headers
Export http header when exporting the whole server.
1 parent c8889ad commit c36f52a

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

lib/bkp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,29 @@ check_exported_conf() {
492492
[[ -n $(conf_read_exported mail) ]] && sudo webinoly -email=$(conf_read_exported mail)
493493
[[ -n $(conf_read_exported header-hsts) ]] && sudo webinoly -header-hsts=$(conf_read_exported header-hsts)
494494
[[ -n $(conf_read_exported header-referrer) ]] && sudo webinoly -header-referrer=$(conf_read_exported header-referrer)
495+
[[ $(conf_read_exported header-xssp) == "false" ]] && sudo webinoly -header-xssp=off
496+
[[ $(conf_read_exported header-xcto) == "false" ]] && sudo webinoly -header-xcto=off
497+
[[ $(conf_read_exported header-xfo) =~ ^(off|deny|sameorigin)$ ]] && sudo webinoly -header-xfo=$(conf_read_exported header-xfo)
498+
[[ $(conf_read_exported header-custom) == "true" ]] && sudo webinoly -custom-headers=reload
499+
[[ $(conf_read_exported header-xfo) == "allow-from" && -n $(conf_read_exported header-xfo-url) ]] && sudo webinoly -header-xfo=allow-from -url=$(conf_read_exported header-xfo-url)
495500

496501
if tar -tvf $file --absolute-names | grep -oq "/opt/webinoly/templates/source/csp_webinoly.data"; then
497502
tar -C / -xf $file /opt/webinoly/templates/source/csp_webinoly.data --absolute-names
498503
sudo webinoly -header-csp=on
499504
fi
505+
if tar -tvf $file --absolute-names | grep -oq "/opt/webinoly/templates/source/pph_webinoly.data"; then
506+
tar -C / -xf $file /opt/webinoly/templates/source/pph_webinoly.data --absolute-names
507+
sudo webinoly -header-permission-policy=on
508+
fi
509+
if tar -tvf $file --absolute-names | grep -oq "/opt/webinoly/templates/source/cch_webinoly.data"; then
510+
tar -C / -xf $file /opt/webinoly/templates/source/cch_webinoly.data --absolute-names
511+
sudo webinoly -header-cache-control=on
512+
fi
513+
if tar -tvf $file --absolute-names | grep -oq "/opt/webinoly/templates/source/rob_webinoly.data"; then
514+
tar -C / -xf $file /opt/webinoly/templates/source/rob_webinoly.data --absolute-names
515+
[[ -s /opt/webinoly/templates/source/rob_webinoly.data ]] && sudo webinoly -header-robots=on
516+
fi
517+
500518

501519
[[ -n $(conf_read_exported log-lines) ]] && conf_write log-lines $(conf_read_exported log-lines)
502520
[[ -n $(conf_read_exported awsiamrole) ]] && conf_write awsiamrole $(conf_read_exported awsiamrole)
@@ -637,13 +655,13 @@ export_site() {
637655
# Check if Custom Cache
638656
if [[ -f /etc/nginx/conf.d/webinoly.conf ]]; then
639657
if [[ -f /etc/nginx/apps.d/$siteto$subn-wpcache.conf || -f /etc/nginx/apps.d/$siteto$subn-phpcache.conf ]]; then
640-
local custom_cache=$(grep -E "^fastcgi_cache_path \/run\/nginx-cache\/${siteto}[ _].*;$" /etc/nginx/conf.d/webinoly.conf)
658+
local custom_cache="$(grep -E "^fastcgi_cache_path \/run\/nginx-cache\/${siteto}[ _].*;$" /etc/nginx/conf.d/webinoly.conf)"
641659
elif [[ -n $(grep -F "# WebinolyProxyCacheStart" /etc/nginx/apps.d/$siteto$subn-proxy.conf) ]]; then
642-
local custom_cache=$(grep -E "^proxy_cache_path \/run\/nginx-cache\/${siteto}[ _].*;$" /etc/nginx/conf.d/webinoly.conf)
660+
local custom_cache="$(grep -E "^proxy_cache_path \/run\/nginx-cache\/${siteto}[ _].*;$" /etc/nginx/conf.d/webinoly.conf)"
643661
fi
644662
if [[ -n $custom_cache ]]; then
645663
[[ ! -f /var/www/webinoly.conf_temp ]] && sudo touch /var/www/webinoly.conf_temp
646-
echo $custom_cache >> /var/www/webinoly.conf_temp
664+
echo "$custom_cache" >> /var/www/webinoly.conf_temp
647665
fi
648666
fi
649667

0 commit comments

Comments
 (0)