How do I setup CORS on Lotus Domino?

后端 未结 3 1471
隐瞒了意图╮
隐瞒了意图╮ 2021-01-14 15:08

I\'m attempting to communicate with Domino via REST via a cross domain request, but I\'m encountering an issue. I\'ve setup an Internet Site document with the IP Address, lo

相关标签:
3条回答
  • 2021-01-14 15:19

    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

    0 讨论(0)
  • 2021-01-14 15:25

    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.

    0 讨论(0)
  • 2021-01-14 15:40

    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).

    0 讨论(0)
提交回复
热议问题