2

I am having trouble with CORS in Wakanda and found this:
https://github.com/Wakanda/wakanda-issues/issues/21

The link above seems to indicate a fix for this bug is 1.0.3.

I am running Wakanda Enterprise 11.0.0.0.

Where may I get this fix?


My Project Settings: Project Setting

Error Response: Response

Additional Data: enter image description here

Tim Penner
  • 3,551
  • 21
  • 36
David Ringsmuth
  • 325
  • 1
  • 12

2 Answers2

2

For your CORS configuration:

you specified 192.168.2.100:80 but you do not need the port number when using the default port 80; you should just use 192.168.2.100. The configuration should look like this when using the default port:

enter image description here

See issue #42: CORS does not work if port 80 is specific in the domain list.

Regarding the bug you referenced:

This comment on Issue #21 has a sample solution download that shows CORS working. In the sample, CORS is enabled on both ends so that both projects allow each other but this can be disabled on the parent side.

I just tested that sample solution (using http://127.0.0.1:8082 as shown in the comments) and it works for me using Wakanda Digital App Factory 1.0.3 (build 11.197492):

enter image description here

Reminder from Issue #21:

For now support for CORS only works when you do not add special headers to your requests

So make sure you are not setting any additional headers with http_request.setRequestHeader()

Regarding where to get Wakanda with the fix from Issue #21:

Community Edition is available at wakanda.github.io

Enterprise Edition is available at wakanda.io

  • As of right now, both of the above sites are providing Wakanda Digital App Factory 1.0.3 for download (that includes build 11.197492)

What to do if you have a new bug?

If you think you have uncovered a new bug you can file a new issue on github.

Community
  • 1
  • 1
Tim Penner
  • 3,551
  • 21
  • 36
  • About an hour ago I downloaded Enterprise from wakanda.io. It shows 11.197492 in the about box. I tested it and my CORS issue remains. It is not fixed. – David Ringsmuth Mar 11 '16 at 21:19
  • I just re-attempted wakanda.io enterprise download. The installer only offers to REMOVE wakanda, because it detects I have the same version already installed. The about box shows build: 11.197492 The bug remains, CORS is not working. – David Ringsmuth Mar 11 '16 at 21:25
  • Tim, I'lll get to this over the weekend.k I'll download and test the same project, and then compare with mine. – David Ringsmuth Mar 11 '16 at 23:17
  • I downloaded and tested [sample from issue #21](https://github.com/Wakanda/wakanda-issues/files/66402/aurelia.zip). It only works as advertised if both projects have CORS enabled for the other project. [CORS Specification](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) does not require the parent to provide Access-Control-Allow.. headers. But it seems that Wakanda is requiring it. If you disable CORS in the parent index.html, and run the project from that parent port, you will see CORS fails for the other port. – David Ringsmuth Mar 13 '16 at 20:22
  • It only works consistently as advertised if both projects have CORS enabled for the other project. If you disable CORS in the parent index.html, and run the project from that parent port, you will see CORS fails for the other port on some of the requests. – David Ringsmuth Mar 13 '16 at 20:30
  • Can you post a simple (low or no javascript) index.html page that accesses a secondary port using CORS as a functional example? It seems that Wakanda 11.197492 does not easily provide a way to test a simple index.html with CORS. It adds Node, Gulp, and automatically injects Livereload into my page. On the flip side, I'm sure that is what would be required of me to submit a bug. – David Ringsmuth Mar 14 '16 at 16:15
  • i did some more testing with the sample from issue #21 and i was able to disable CORS for the web server on port 8082, leaving CORS enabled on 8081 (which is configured to allow 8082), then restarted the project and hit 127.0.0.1:8082 and it had `success` for each request that was coming from 8081 through CORS. The sample from issue#21 seems fairly slimmed-down and also tests multiple aspects of CORS. – Tim Penner Mar 14 '16 at 16:28
  • For your solution, can you try adding `127.0.0.1` to the allowed list for CORS instead of `127.0.0.1:80` - the port is not needed if using the default port – Tim Penner Mar 14 '16 at 16:43
  • David i just filed [CORS does not work if port 80 is specific in the domain list #42](https://github.com/Wakanda/wakanda-issues/issues/42) which i think is the issue you are seeing. – Tim Penner Mar 14 '16 at 17:15
  • Tim, you are right, 127.0.0.1 or my local ip address both work for CORS! :-) Thank you for filing the bug report :-) – David Ringsmuth Mar 14 '16 at 17:27
2

My Wakanda solution was upgraded from v10 to v11. This was the cause of CORS failing as the .waSettings file which defines CORS has moved locations in the upgrade.

The answer to CORS failing for me was to create a new Solution in v11, and copy into it the needed files.

CORS now works as advertised!

David Ringsmuth
  • 325
  • 1
  • 12