admin管理员组文章数量:1279207
I have a cloudfront distribution that backs into and S3 bucket. There are custom error pages that direct 403/404 errors to "/notfound.html". The S3 bucket contains a directory per environment, and there is a cloudfront function that, amongst other things, directs the incoming request into the appropriate folder based on URL (host header):
async function handler( event ) {
var request = event.request;
// Backend redirection for dev/test.
switch ( request.headers.host.value ) {
case 'dev.mydomain':
request.uri = '/dev' + request.uri;
break;
case 'test.mydomain':
request.uri = '/test' + request.uri;
break;
default:
request.uri = '/prod' + request.uri;
break;
}
return request;
}
The custom error page appears to bypass the cloudfront function and thus is served from the backend root rather than the environment specific folder. Anyone now of a workaround to this? I'd thought to return 302 with the error page config, but this isn't supported by cloudfront.
本文标签:
版权声明:本文标题:amazon web services - Any way (or workaround) to have cloudfront functions apply to custom error pages? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741207984a2358533.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论