Angular Azure静态Web应用iframe跨域DOMException问题求助
问题
我有一个基于Angular开发的Web应用,通过iframe展示外部Azure Function API返回的HTML内容,该单页应用(SPA)托管在Azure Static Web App上。本地运行时页面正常,iframe能正确显示内容,但部署到云端后出现跨域错误:
DOMException: Failed to read a named property 'document' from 'Window': Blocked a frame with origin "xy.domain.com" from accessing a cross-origin frame.
本地环境中,我通过创建proxy.conf.json配置代理解决了跨域问题,配置内容如下:
{ "/api/myendpoint": { "target": "http://127.0.0.1:7071", "secure": false, "logLevel": "debug", "headers": { "connection": "keep-alive" } } }
请问Azure Static Web App是否支持这种代理方式?我尝试使用以下proxy.conf.json配置但无效:
{ "/api/myendpoint": { "target": "https://myendpointXXX.azurewebsites.net/", "secure": false, "logLevel": "debug", "headers": { "Connection": "keep-alive" } } }
内容的提问来源于stack exchange,提问作者pbachman
相关产品推荐
相关产品推荐

