Search code examples
xpageslotus-domino

How do I setup CORS on Lotus Domino?


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, localhost and a server name listed as the host names. The internet site is working as a redirect rule I've setup on that internet site is working. I've also setup a Web Site Rule with the following:

Web Site Rule

Now when I attempt to hit the rest.xsp page via an html GET request I'm getting this error:

    XMLHttpRequest cannot load 
http://192.168.1.104/testing/restService.nsf/rest.xsp/testRest?reqType=UserCanAc…TOP&startId=BA4241EC74912860ED60FD1123473BF7&returnType=ARRAYOBJECTS. 
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 
'http://127.0.0.1:8020' is therefore not allowed access.

Here are the request headers:

Accept:application/json, text/javascript, */*; q=0.01
Cache-Control:max-age=0
Origin:http://127.0.0.1:8020
Referer:http://127.0.0.1:8020/Backbone%20Playground/index.html
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36

I can't for the life of me figure out what I've missed. Can someone point me in the right direction?


Solution

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