I have a lot of static pages, which include html files + js (SCORM packages).
I have dynamic pages, also with JS which talks to the static pages JS.
Static pages are being opened in an iframe, and we get them as-is from a third party (SCORM content), so no changes there are possible.
For performance sake, and centralization sake, we want to put all the static files on a dedicated server with lighthttp.
Problem: now the js in the dynamic pages (served via Apache) don't have permission to talk to the light-http hosted pages.
The domain is the same for both, the port is different.
Any suggestions on how to accomplish this.
Make sure both dynamic and static content is server under the same domain and port number (I errors are because of JavaScript 'sandboxing'). That can be achieved by proxying selected request from one server or the other.
Basically there are three options: 1. Set up Lighttpd on port 80 and let it proxy (forward) requests to the dynamic content to the Apache on the other port or machine 2. Set up Apache on port 80 and let it proxy (forward) requests to the static content to the Lighttpd running on the other port or machine 3. Set up separate proxy server will would forward static content requests to one server and the dynamic requests to the other
In both cases 'mod_proxy' (for the appropriate server) will be needed. In case 2 mod_rewrite may be useful if redirected URLs are not under common prefix.
I prefer option 1., as the server on port 80 needs to handle all the requests (those it fully serves and those which are forwarded) then let it be the lighter process.