Wednesday, 15 January 2014

c# - How to verify amazon url being called for Imageresizer using S3Reader? -



c# - How to verify amazon url being called for Imageresizer using S3Reader? -

i using s3reader plugin imageresizer read deliver resized images amazon.

i having troubles getting working in production environment because unable see going on under covers.

i have added substantial logging , know imagemissing event beingness fired, when request expected image.

if check url manually image there, thing can think somewhere in processing of imageresizer via s3reader plugin?

so how can see url imageresizer using request image amazon?

i suspect because bucket in aisapac part somehow not using right url?

some things note, process images on media subdomain , re-write url (this impact too?)

my code , config follow:

<resizer> <diskcache dir="~/app_data" autoclean="true" /> <clientcache minutes="1440" /> <plugins> <add name="mvcroutingshim" /> <add name="s3reader" buckets="media.domain.com" usesubdomains="true" /> <add name="diskcache" /> </plugins> </resizer> private static void imageresizer_rewrite(ihttpmodule sender, httpcontext context, iurleventargs args) { string subdomain = context.request.url.subdomain(); if (string.isnullorwhitespace(subdomain) || subdomain != appsettings.mediasubdomain) return; args.virtualpath = string.format("/s3/{0}", appsettings.amazons3bucketname) + args.virtualpath; logger.error("new virtualpath: " + args.virtualpath); } private static void imageresizer_onpostauthorizerequeststart(ihttpmodule sender2, httpcontext context) { var subdomain = context.request.url.subdomain(); if (string.isnullorwhitespace(subdomain) || subdomain != appsettings.mediasubdomain) return; config.current.pipeline.skipfiletypecheck = true; config.current.pipeline.modifiedquerystring["cache"] = servercachemode.always.tostring(); logger.error("imageresizer process: " + context.request.rawurl); }

there no warnings or errors in debug trace, , receive 404 when expect image returned.

amazon s3 suggests using subdomain address method ensure optimal performance non-us regions - s3reader default (and have enabled).

as such, bucket name can't have periods or leading dashes (but can have embedded dashes).

assuming value of amazons3bucketname "media.domain.com", reason image lookup failure.

see notes on bucket naming @ bottom of s3reader plugin documentation page.

c# asp.net-mvc imageresizer

No comments:

Post a Comment