简体   繁体   中英

Refreshing an Added Alias Directory to Apache's HTTPD

I'm exposing files using Apache's httpd <Directory> as below

Alias /getfiles "/web/playbooks/tmpfiles"

<Directory "/web/playbooks/tmpfiles">
     Options Indexes MultiViews
     AllowOverride None
     Require all granted
</Directory>

With this I'm able to access all files/folder inside /web/playbooks/tmpfiles through web browser URL like the below.

http://<server>:<port>/getfiles/<anyfile.txt>

Is it possible to refresh the above URL so I could see latest changes to files/folder inside /web/playbooks/tmpfiles periodically?

Any solution would be great.

You could try to make the client autorefresh by itself through instructions in the html itself instead of trying to do something weird which is not probably in the http spec. (I might be wrong).

For example, according to your directory entry, load module_autoindex module and then use this config:

<Directory /web/playbooks/tmpfiles>
     Options Indexes MultiViews
     IndexOptions FancyIndexing
     IndexHeadInsert "<meta http-equiv=\"refresh\" content=\"10\">"
     AllowOverride None
     Require all granted
</Directory>

This way Apache httpd will add that tag in the html and the client will know it has to autorefresh the page each 10 seconds. Generally it is not recommended to set this too low, so perhaps 10 seconds and above is alright for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM