この署名付き URL メソッドがローカルでは機能するが実サーバーでは機能しない原因を知りたいですか?
ローカルでは 12 秒で期限切れになる URL を生成しますが、サーバーでは期限切れの URL を返しますか?
def s3_signed_url(file_path):
import boto
s3conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
bucket = s3conn.get_bucket(BUCKET_NAME, validate=False)
key = bucket.new_key(file_path)
signed_url = key.generate_url(expires_in=12)
return signed_url
@never_cache
def enjoy_the_show(request, movie_id):
m = get_object_or_404(Movie, pk=movie_id)
iOS = is_ios_device(request)
if (iOS is True):
movie_path = m.m3u8_url
movie_path = movie_path.replace('https://s3.amazonaws.com/domain.com','')
signed_url = s3_signed_url(movie_path)
return render_to_response('movies/enjoy_show_iOS.html', {'signed_url':signed_url,'movie': m,'is_logged_in':is_logged_in(request)},context_instance=RequestContext(request))
else:
return render_to_response('movies/enjoy_show.html', {'movie': m,'is_logged_in':is_logged_in(request)},context_instance=RequestContext(request))