Fixing 302 redirect issue with media