How to run WeInRe with cross domain restriction on web


I am trying to run WeInRe, installed on my mac as a nodejs module. But, the client does not load the javascript, because nodejs server runs on port 8080, and my site runs on 80.

Any help on how can I resolve this issue?

Thanks, pd

Problem courtesy of: pd1980


Found it! The solution is to run the NodeJS server alongside Apache on the same port.

Here is the final solution to run apache website on port 80, node js service on port 8080 and use .htaccess RewriteRule from above blog post, modified to run WeInRe module through nodejs.

In the DocumentRoot of the apache website, add the following:

Options +FollowSymLinks -MultiViews

<IfModule mod_rewrite.c>

RewriteEngine on

# Include the WeInRe javascript in the client like this:
# <script src=""></script>
# Access the WeInRe console like this:
RewriteRule ^node/(.*)$1 [P]

# Redirect for all the calls WeInRe makes from the client
RewriteRule ^ws/(.*)$1 [P]

This will route all the WeInRe calls to the port 8080 at the server, but will not affect the client, and so no cross-domain errors.

Solution courtesy of: pd1980


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.