Trouble-shooting CORS in Play Framework 2.4.x

前端 未结 7 693
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 14:55

I have a java play framework 2.4.x web app providing a JSON/HTTP API. When I run my front-end HTML/JS file:///Users/nize/tmp/index.html calling the API on

7条回答
  •  爱一瞬间的悲伤
    2020-12-10 15:56

    This will probably not solve the problem for the poster, but it solved the problem for me when I had the same symptoms, and I am posting it in case it can help others in the same situation.

    I had actually misunderstood how CORS is working. I have two separate Play applications, one with a REST API and one with a web interface using the REST API. I followed the instructions in the documentation page mentioned in the question, but my mistake was that I did it on the web interface application. When I instead did it on the REST API application, it worked immediately.

提交回复
热议问题