开发者

changing (masking?) cloud files url

looking for a solution to mask / use a different url of a file rather than the cloud hosted one.

for example, wish to display an image

TEST.JPG

from the url

http://cloud.filehosting.example.com/12345/asdfg/123455/sjklksgklshglhfjgl.jpg

as

http://mysite.com/image/TEST.JPG

how is this called (so i can actually lo开发者_如何学Gook it up on google, having problems weeding out results without the common name)? and how can it be done?

the reason is that if people want to access their images directly, they should use a link from my site, not the clouds, but the file should be accessed from the cloud.


It depends on how well hidden you want the "cloud" URL to be.

If you are OK with the user being able to discover the "cloud" URL, you can implement the functionality using simple redirect. When the user click on a link to your URL representation of the image, you just respond with 302 and ContentLocation header that has the actual URL for the file.

If you want the user to never be able to discover the "cloud" URL, you can write simple method on your server that makes a separate request to the "cloud" URL, reads the response and then sends it as a response back to the user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜