WebFaction
Community site: login faq

Hi, I am having trouble setting up Node.js as a proxy server (as well as a long polling server) to a Django app backend. I have node set up as a custom app listening to a certain port as well as the Django app listening to a separate port. The two apps are communicating but I have three remaining problems.

  1. Node.js is appending a few extra bytes to the beginning and end of the data section of the HTTP packet. This results in the following. (random hex values) html content (more random hex values). I saw a example of this here http://forum.webfaction.com/viewtopic.php?pid=13137#p13137 with a fix in the chunking if the HTTP version <= 1.0 but this should be fixed in the newer versions of node.js
  2. Running AJAX requests from the client to Node.js which is then proxied to Django, results in a request to Django and a response back to node.js but then it is never transmitted back to the client. When I debug the headers on my local machine and the deployed code on the server shows that locally the request are marked as "keep-alive" while the server has them marked as "close".
  3. Cookies do not seem to be transfered from the Django app to the node.js app. When I try and log into the django admin page I get the error "Looks like your browser isn't configured to accept cookies. Please enable cookies, reload this page, and try again."

I know some of this may be beyond the support level of Webfaction but any suggestions would be appreciated.

Thanks, Jonathan

asked 12 Dec '10, 21:10

joneath
123
accept rate: 0%

Are you aware we use nginx to proxy requests? This is what is causing the keep alive issue. An illustration of our server stack may be seen here,

http://docs.webfaction.com/user-guide/_images/inside-the-server.png

You would have to set up your application to not route through the nginx server. This can be done if you submit a support ticket to open the port. The front-end nginx server will always listen on port 80, even on the dedicated IP. We can only open ports not used by our system above 1024.

(12 Dec '10, 21:48) johns
Be the first one to answer this question!
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:

×909
×67

question asked: 12 Dec '10, 21:10

question was seen: 6,407 times

last updated: 12 Dec '10, 21:48

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