Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to run WeInRe with cross domain restriction on web

How to run WeInRe with cross domain restriction on web

Problem

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

Solution

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

http://arguments.callee.info/2010/04/20/running-apache-and-node-js-together/

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



RewriteEngine on

# Include the WeInRe javascript in the client like this:
# 
# Access the WeInRe console like this:
# http://your.domain.com/node/client#xyz
RewriteRule ^node/(.*) http://your.domain.com:8080/$1 [P]

# Redirect for all the calls WeInRe makes from the client
RewriteRule ^ws/(.*) http://your.domain.com:8080/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

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

How to run WeInRe with cross domain restriction on web

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×