WebFaction
Community site: login faq

Hi,

I've setup a nodejs application on a subdomain such as node.domain.com using a port 25463 (http://node.domain.com:25463).

I then use forever to launch it such as : ./bin/forever start server.js

Within my Rails app, I'm using socket.io to communicate with the node server and listen for it (pubsub system).

socket = io.connect('http://node.domain.com:25463')

The problem is doing it that way, I've got an error :

GET http://node.domain.com:25463/socket.io/1/?t=1397773773470 net::ERR_CONNECTION_REFUSED

So I decided to come back to webfaction control panel and saw that application with an open port should use an IP address instead.

So I replace my above code with :

socket = io.connect('http://155.144.155.144:25463')

But now I've got another error :

xmlhttprequest cannot load is not allowed by access-control-allow-origin

In either way, I somehow cannot making it work.

Any ideas?

Thanks

asked 17 Apr '14, 22:34

El - Key
1112
accept rate: 0%


You're looking at two different problems.

First, regarding the error "xmlhttprequest cannot load is not allowed by access-control-allow-origin", in general this can be solved by setting an Access Control header. More information is covered in this related community post.

However, since your main goal is not to actually serve content from a different domain, you shouldn't need to do that.

Instead, the main problem seems to be that your "node.domain.com" domain is not resolving to the correct address. This command will show which IP your domain points to:

dig +short A node.domain.com

Most likely, you have it pointing to the server's main IP address, but the open port is on the server's secondary IP address. Therefore, when requests go out for "http://node.domain.com", they don't work, because they're arriving at the wrong IP.

So, the simple solution is to edit your website record where "node.domain.com" is pointing to your application, and set it to use "155.144.155.144" as the IP address instead. Then, allow time for DNS propagation, make sure "dig +short A node.domain.com" returns the new IP, and then you should be able to connect with io.connect('http://node.domain.com:25463').

Hope that helps!

permanent link

answered 18 Apr '14, 00:02

ryans ♦♦
5.0k93260
accept rate: 43%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×67
×8

question asked: 17 Apr '14, 22:34

question was seen: 6,153 times

last updated: 18 Apr '14, 00:02

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM