How to fix “404 ERROR: Resource has expired”?

Issue: Resource has expired
 

Reason: An expired resource resembles the existence of a cached artifact that was expired. In Artifactory, some artifacts (usually metadata files, such as the "maven-metadata.xml" file) are called "Expirable Resources" - these are resources that need to be replaced regularly with their upstream version.  

The only way for artifactory to know whether it needs to replaces such expirable resources is to go and check the file on the remote location. In order not to do that on every request, and avoid the potential network overhead, Artifactory has an expiry mechanism (configurable), where after a defined period, the metadata file will be considered as expired, which means that Artifactory will go and search for a newer version on the remote endpoint.

When a download request is issued directly to the '-cache' endpoint (i.e my-remote-repo-cache), the automatic expiry mechanism will be bypassed. Due to that, if the artifact has already reached its expiry, Artifactory will respond with a 404 "Resource has expired" error.

Resolution:  make sure to not resolve artifacts from -cache Repos. Because after X seconds the cached metadata files will be considered as expired.
 

Note: the cache expire parameter is configurable by going to the WebUI → Admin → Repositories | Remote → Select your repository → Advanced → Change the 'Metadata Retrieval Cache Period (Sec)' value. You can read here a bit more on the cache management in Artifactory.