{{tag>apache webserver}} ====== Download file from apache website by sending custom header ====== Download some file from URL like https://domain.com/somedir/myfile.tar. In apache host configuration add this: SetEnvIf X-My-Token "mysecrettoken" my-token Alias /somedir /var/www/somedir Require env my-token Then you can use wget to get the file and pass it the secret: wget --header='X-My-Token: mysecrettoken' https://domain.com/somedir/myfile.tar --output-document=/home/user/Downloads/myfile.tar ====== Tested on ====== * GNU Wget 1.20.3 * Apache/2.4.41 ====== See also ====== [[wiki:password_protect_site_htaccess|Password protect site with htaccess in Apache]] ====== References ====== * https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#requiredirectives * https://httpd.apache.org/docs/current/mod/mod_alias.html