How to solve JavaScript origin problem with an application and static file server
Posted
by recipriversexclusion
on Stack Overflow
See other posts from Stack Overflow
or by recipriversexclusion
Published on 2010-04-28T20:42:45Z
Indexed on
2010/04/28
20:47 UTC
Read the original article
Hit count: 280
In a system that I'm building I want to serve
- Static files (static HTML pages and a lot of images), and
- Dynamic XML generated by my servlet.
The dynamic XML is generated from my database (through Hibernate) and I use Restlets to serve it in response to API calls. I want to create a static file server (e.g. Apache) so that this does not interfere with the dynamic server traffic. Currently both servers need to run on the same machine.
I've never done something like this before and this is where I'm stuck:
The static HTML pages contain JavaScript that makes API calls to the dynamic server. However, since the two servers operate on different ports, I get stuck with the same origin problem. How can this be solved?
As a bonus, if you can point me to any resources that explain how to create such a static/dynamic content serving system, I'll be happy.
Thanks!
© Stack Overflow or respective owner