How do I setup CORS on Lotus Domino?

a 夏天 提交于 2019-12-01 09:33:43

I know this is kinda old thread but since it's not being answered and there are some news, I think it's worth throwing in my own findings.

  1. Mark Leusink caved into this and discovered that there's a need to accept also return code 204 for GET and 201 also for any write (PUT / POST) operations
  2. There is now a new possibility to include a fourth Response Header to all website rules by the means of notes.ini parameter "HTTPAdditionalRespHeader=", see this technote

However, I'm also struggling on completing a CORS task currently, because Domino always responds with an 401 to the preflight (which seems clear as it comes unauthenticated, at least within Chrome).

The CORS header is part of the response, so you need to check if you get a CORS response header with your page. In any case, for an XPage you can get direct access to the servlet response object and set the header in your XPage:

   var externalContext = facesContext.getExternalContext(); 
   var response = externalContext.getResponse();
   response.setHeader("Access-Control-Allow-Origin","*");

You want to replace the * with a little more restrictive setting. Cors doesn't work in all browsers, so you need to check that end too.

Miguel Calvo

I think your configuration is fine and you can test it using CURL . You should be able to see the Custom Headers by checking any URL different to the one you're using.

The problem, maybe, is due to the XPages Extension Library control, REST Service, you're using. I think the "HTTP response headers" are not applied for this control. I've tested it in Domino 8.5.3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!