我们有一个网站,其中前端是托管在 Azure Blob 存储中的 SPA,后端托管在 Azure 应用服务中。该站点的前面将是 Azure Front Door。我正在尝试将请求路由到正确的后端。
应用服务中托管的站点中的所有终结点都具有 /backend/* 格式。
在前端,我们在根目录中有一些文件,/index.html 和一些其他文件,如 favoicon.ico,然后是 /assets 文件夹中的一些文件。这些唯一的共同点是它们在文件名中有一个句点。
SPA 具有不对应于任何物理文件的动态 url,例如 /login。
我想要 Front Door 中的以下路由,但我在为/*.*
模式创建规则时遇到问题,即将看起来像文件的所有内容路由到 blob 存储而无需重写 url。
╔═══════════════════════════════╦═══════════════╦══════════════╦══════════════════════════════════════════════════╦══════════════════════════════════════════════════════════════════════════════════════════════╗
║ Source url ║ Route pattern ║ Backend pool ║ Target url ║ Description ║
╠═══════════════════════════════╬═══════════════╬══════════════╬══════════════════════════════════════════════════╬══════════════════════════════════════════════════════════════════════════════════════════════╣
║ www.example.com/backend/login ║ /backend/* ║ App service ║ ourbackend.azurewebsites.net/backend/login ║ All backed routes ║
║ www.example.com/ ║ / ║ Blob storage ║ ourstaticstorage.web.core.windows.net/index.html ║ Requests to the root should return index.html from blob storage ║
║ www.example.com/favicon.ico ║ /*.* ║ Blob storage ║ ourstaticstorage.web.core.windows.net/*.* ║ Blob storage contains other static files that should be returned. All files contain a period ║
║ www.example.com/scripts.css ║ /*.* ║ Blob storage ║ ourstaticstorage.web.core.windows.net/*.* ║ Blob storage contains other static files that should be returned. All files contain a period ║
║ www.example.com/styles.css ║ /*.* ║ Blob storage ║ ourstaticstorage.web.core.windows.net/*.* ║ Blob storage contains other static files that should be returned. All files contain a period ║
║ www.example.com/login ║ /* ║ Blob storage ║ ourstaticstorage.web.core.windows.net/index.html ║ Catch all route for deep links in the spa ║
╚═══════════════════════════════╩═══════════════╩══════════════╩══════════════════════════════════════════════════╩══════════════════════════════════════════════════════════════════════════════════════════════╝
还有其他方法可以完成这项工作吗?