Those expiry headers are set as part of the http response, so the external server sets that. You could try sending that organization an email to see if they'd be willing to change their expiry header, but honestly, I wouldn't do that if someone asked, and I'm usually agreeable to just about anything.
The expires header is a great way to reduce server load, so if an external server sets one that's near, chances are good that they plan to update the resource frequently. Or, some resources don't have expiry headers, and that's usually a good sign that you can't rely upon that external script.
If you want to resort to an ugly hack, you could write a script to go out, fetch that external script and store it as a static script yourself. I absolutely don't recommend doing that because then you'll just add another package to manually manage.
Alternately, if the external server does not set any expiry headers, you might want to look to other options. Good server admins will set that for everything people would download, just because they don't want to incur load having the same users download the same script $x times a week. Would the license permit you to save the script and host it yourself?
Expiry date on external scripts
Hello,
Is it possible to add an expiry date to script file : Ex : http://www.xxx.js.
Can we do it on IIS ?
Thanks for helping.
Regards,
Kusum
If you want static content (files on disk) to be served with an expiry date, then you can add in your web.config a staticContent
Is that what you are looking for?
Hello Damiaan,
Thank you for your reply.
I have already done the above for the static scripts. I want to add expiry date for external scripts.
can you please help ?
Thanks,
K
That's tough, Kusum...
Those expiry headers are set as part of the http response, so the external server sets that. You could try sending that organization an email to see if they'd be willing to change their expiry header, but honestly, I wouldn't do that if someone asked, and I'm usually agreeable to just about anything.
The expires header is a great way to reduce server load, so if an external server sets one that's near, chances are good that they plan to update the resource frequently. Or, some resources don't have expiry headers, and that's usually a good sign that you can't rely upon that external script.
If you want to resort to an ugly hack, you could write a script to go out, fetch that external script and store it as a static script yourself. I absolutely don't recommend doing that because then you'll just add another package to manually manage.
Alternately, if the external server does not set any expiry headers, you might want to look to other options. Good server admins will set that for everything people would download, just because they don't want to incur load having the same users download the same script $x times a week. Would the license permit you to save the script and host it yourself?
Thanks for the reply Greg. It was very clear.
Thanks Kusum, that's kind of you to say! Sorry that I didn't have the answer you wanted to hear. :)
is working on a reply...