Reputation: 5656
I want to use html/js as the graphical interface for my Java apps, and for this I have a Jetty http server running on port 8040
.
The client scripting is done on a Mongoose server on port 8080
, using the jQuery AJAX get()
method.
When performing the AJAX request, I get the
XMLHttpRequest cannot load http://localhost:8040/. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
I did a bit a google:ing and found that this is known as the Same origin policy, and if I understand this right, the script can not make a request to another port on the same adress? So how do I make this work, ie. run both the java server and the javascript client on the same machine?
Upvotes: 0
Views: 846
Reputation: 7182
Take a look at this wiki page:
http://wiki.eclipse.org/Jetty/Feature/Cross_Origin_Filter
Upvotes: 2