![](/img/trans.png)
[英]How to port Angular SPA (using http-server) to Azure WebApp?
[英]How to serve Angular 2 SPA with Routes from Azure Blob via Azure Verizon Premium CDN
這里沒有足夠的關於重寫規則的文檔https://docs.microsoft.com/en-us/azure/cdn/cdn-rules-engine-reference-features 。 還需要4個小時才能刷新,因此嘗試各種正則表達式組合是不切實際的。
我在Azure Blob上托管了一個Angular 2單頁應用程序(英雄樣本應用程序),並希望從Azure CDN提供它。 但是,Angular 2路由需要特殊處理,即重寫到index.html的路由。 這是我使用NGINX代理的工作示例。 如何將其翻譯為Azure Verizon Premium CDN?
# Filename: /etc/nginx/nginx.conf
http {
...
rewrite_log on;
server {
listen 80;
server_name www.heroes.com;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
location / {
error_log /var/log/nginx/rewrite.log notice;
rewrite '^(\/(\w+))*\/?(\.\w{5,})?\??([^.]+)?$' /heroes/index.html break;
proxy_pass https://xxxxxx.blob.core.windows.net/heroes/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.