找到你要的答案

Q:Azure Storage - Handling Double Slash in URL

Q:Azure存储-处理双斜线网址

I'm in the process of moving my companies collection of files (15TB) to azure blob storage. Unfortunately these files are pulled down by mobile apps which build the final bit of the URL on the devices. It seems on the apple apps that the device adds a "/" before appending the rest of the path e.g it will take the domain we pass down in the request:

Domain Passed in Request: "files.mycompany.com/" Appended by Apple Devices "/folder/file.jpg" Appended by Android Devices "folder/file.jpg"

This causes The apple devices to have a double slash in the path ("//"). When these files are coming from our current datastore this is fine as it evaluates "//" to a single "/" but on azure this isn't the case.

Due to this being one devices, we cannot easily update all our apps and expect every user to actually update. So is there something on azure or maybe something I can do with a custom domain which I could rewrite the URL to remove the "//"?

我在移动我的公司文件的收集过程(15tb)到Azure Blob存储。不幸的是,这些文件被拉下的移动应用程序的设备上的最后一个网址。它似乎在苹果的应用程序,设备添加一个“/”前添加路径如其余将域我们通过在请求:

Domain Passed in Request: "files.mycompany.com/" Appended by Apple Devices "/folder/file.jpg" Appended by Android Devices "folder/file.jpg"

这会导致苹果设备在路径中有一个双重斜线(“/ /”)。当这些文件来自我们当前数据库中这是很好的评价“/”,一个“/”但在Azure的情况不是这样的。

由于这是一个设备,我们不能轻松地更新所有的应用程序,并期望每个用户实际更新。所以有一些东西在Azure或也许我可以做一个自定义域,我可以重写URL删除“/ /”?

answer1: 回答1:

You can definitely include the "/" as a legitimate part of the file URL. Hence as long as you upload it with the extra "/" and it will be stored in storage with a name containing "//" - meaning if you then request the object including "//" it will be returned. The problem then is that the Android apps would either need to be updated which I am guessing has the same problem as the Apple apps. One solution to this is to upload the image twice once with single-slash and the other with double-slash - is that a short-term solution until you have updated the Apple app to behave correctly?

Alternatively you could route the Apple apps through some kind of a proxy that you would have to build that would rewrite the URL. IIS has rewriting support which you can read more about here: http://www.iis.net/downloads/microsoft/url-rewrite.

您可以肯定包括“/”作为文件URL的合法部分。因此,只要你上传它额外的“/”,它将存储在存储与名称包含“/ /”-这意味着如果你要求对象,包括“/ /”它将返回。问题是,Android应用程序要么需要更新,我猜与苹果应用程序有同样的问题。其中一个解决方案是上传图像两次一次斜线,另一个与双斜线-这是一个短期的解决方案,直到你已经更新了苹果应用程序的行为正确吗?

或者,您可以路由苹果应用程序通过某种类型的代理,你将不得不建立,将重写网址。IIS重写的支持,你可以阅读更多关于这里:http://www.iis.net/downloads/microsoft/url-rewrite。

c#  azure  url-rewriting  windows-azure-storage