2017-10-16 148 views
0

我有一个在Java(Spring)中实现的应用程序,该应用程序从AMP页面被称为POST方法。有时我成功的消息没有出错,有时我得到这个错误在Java中设置AMP访问控制允许源头标头

"[amp-form]" "Form submission failed: Error: Response must contain the AMP-Access-Control-Allow-Source-Origin header​​​" 

在我的Java应用程序,我已经尝试添加“AMP存取控制允许来源-Origin标”这样的

@RequestMapping(value = "/contact-amp", method = RequestMethod.POST) 
@ResponseBody 
@CrossOrigin(allowedHeaders = {"Access-Control-Allow-Origin *", "AMP-Access-Control-Allow-Source-Origin *", "Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin *"}) 
public SendInformationRequestV3Response saveAmp(@ModelAttribute SendInformationRequestV3 info) { 
    return repository.getSendInformationRequestV3Response(info); 
} 

但我不确定这是否正确。我没有在AMP端设置任何标题。我已经在AMP 文档中检查了'CORS请求,但没有帮助我。任何想法&建议来解决这个问题?

回答

-1

如果您使用chrome作为web应用程序,则可以在浏览器中添加扩展。 扩展:允许控制允许来源

相关问题