gpt4 book ai didi

azure - 如何在 Azure CDN 上设置重写规则以提供与路径模式不匹配的 index.html?

转载 作者:行者123 更新时间:2023-12-02 23:49:13 24 4
gpt4 key购买 nike

我想使用 Azure CDN(显然由 EdgeCast 提供支持)为我的 React + GraphQL Web 应用程序提供静态内容。

CDN 将从存储帐户中提取静态文件,Node.js 将处理 GraphQL 端点。

为了使客户端路由正常工作,我需要为所有与静态内容路径不匹配的请求提供 /static/index.html (/static/somefile .ext)。

我想避免使用 Node.js 以这种方式提供 index.html:

var express = require('express');
var app = express();

app.all('*', function(req, res){
res.sendfile("index.html");
});

最佳答案

如果您使用的是 Verizon Premium SKU,则可以通过单击 Azure 门户中的“管理”来访问规则引擎。

我会使用这样的规则来重写除 index.html 的静态链接之外的所有内容

rewrite rule screencap

关于azure - 如何在 Azure CDN 上设置重写规则以提供与路径模式不匹配的 index.html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39800105/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com