check if resource exists, set vary header and content-type header