How to solve the problem of JavaScript origin with an application and a static file server
In the system I create I want to serve
- Static files (static HTML pages and many images) and
- Dynamic XML generated by my servlet.
Dynamic XML is generated from my database (via Hibernate) and I use Restlets to serve in response to API calls. I want to create a static file server (like Apache) so that it doesn't interfere with dynamic server traffic. Currently, both servers should be running on the same machine .
I've never done this before, and this is where I got stuck:
Static HTML pages contain JavaScript that makes API calls to the dynamic server. However, since the two servers are running on different ports, I am stuck with the same origin issue. 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!
a source to share
You must configure mod_proxy in apache to forward dynamic requests to whatever server you are using. Your existing setup (i.e. Two separate ports) is perfect, you just need to point the apache proxy dynamic requests to my backend server without telling the browser.
This page should get you started - http://httpd.apache.org/docs/1.3/mod/mod_proxy.html
a source to share