Newebe should pay attention to the "X-Forwarded-For" header. Then, the
log will reveal the correct source IP for the requests.
Shall I open a Github bug report?
--
Robin
Done. Thanks.
Now that I am not running in Debug mode, there does not seem to be any
logging information. Is that right?
--
Robin
Frank, thanks for responding. That file does not exist anywhere in my
Newebe Git repo. Is that where I would find it? (I run "python2
newebe_server.py" from that directory.)
--
Robin
Sure. Here is the output of 'ls -1a':
.
..
.git
.gitignore
README.rst
__init__.py
__init__.pyc
activities
auth
contacts
core
deploy
docs
lib
newebe_server.py
news
notes
pictures
profile
settings.py
settings.pyc
static
sync
syncdb.py
No.
Do you want me to insert some debug code somewhere? If you don't have
time to describe in email, I'll do it myself, but not soon.
--
Robin
After I issue "python2 newebe_server.py", those log messages are never
printed. Perhaps it is not trying to "Daemonize"?
I changed the settings so that Debug = True, now, so that might
explain why it's now not daemonizing. Sorry for the confusion.
Here is my stdout:
[INFO] 2012-01-14 00:37:56,398: Sets up application server.
[INFO] 2012-01-14 00:38:33,307: 200 GET / (142.166.189.94) 72.42ms
[INFO] 2012-01-14 00:38:33,405: 200 GET
/static/platform/styles/common.css (127.0.0.1) 16.79ms
[INFO] 2012-01-14 00:38:33,435: 200 GET /static/notes/styles/notes.css
(142.166.189.94) 0.79ms
[INFO] 2012-01-14 00:38:33,436: 200 GET
/static/contacts/styles/contacts.css (142.166.189.94) 0.55ms
[INFO] 2012-01-14 00:38:33,439: 200 GET
/static/profile/styles/profile.css (142.166.189.94) 0.66ms
[INFO] 2012-01-14 00:38:33,445: 200 GET
/static/activities/styles/activities.css (142.166.189.94) 0.75ms
[INFO] 2012-01-14 00:38:33,446: 200 GET /static/news/styles/news.css
(142.166.189.94) 0.56ms
[INFO] 2012-01-14 00:38:33,456: 200 GET
/static/pictures/styles/pictures.css (127.0.0.1) 0.86ms
[INFO] 2012-01-14 00:38:33,481: 200 GET
/static/css/jquery-ui-black-tie.css (127.0.0.1) 1.00ms
[INFO] 2012-01-14 00:38:33,483: 200 GET /static/css/fileuploader.css
(127.0.0.1) 0.65ms
[INFO] 2012-01-14 00:38:33,486: 200 GET /static/js/jquery.js (127.0.0.1) 1.21ms
[INFO] 2012-01-14 00:38:33,495: 200 GET /static/js/jqueryui.js
(127.0.0.1) 2.30ms
[INFO] 2012-01-14 00:38:33,496: 200 GET /static/js/date.js (127.0.0.1) 0.74ms
[INFO] 2012-01-14 00:38:33,501: 200 GET /static/js/json2.js (127.0.0.1) 0.77ms
[INFO] 2012-01-14 00:38:33,533: 200 GET /static/js/underscore.js
(127.0.0.1) 0.78ms
[INFO] 2012-01-14 00:38:33,584: 200 GET /static/js/backbone.js
(127.0.0.1) 1.39ms
[INFO] 2012-01-14 00:38:33,588: 200 GET /static/js/showdown.js
(127.0.0.1) 1.21ms
[INFO] 2012-01-14 00:38:33,602: 200 GET /static/js/fileuploader.js
(127.0.0.1) 1.07ms
[INFO] 2012-01-14 00:38:33,604: 200 GET /static/js/jasmine.js (127.0.0.1) 1.20ms
[INFO] 2012-01-14 00:38:33,695: 200 GET /static/js/jasmine-html.js
(127.0.0.1) 0.74ms
[INFO] 2012-01-14 00:38:33,697: 200 GET /static/css/jasmine.css
(127.0.0.1) 0.55ms
[INFO] 2012-01-14 00:38:33,722: 200 GET /static/news/app/news.dev.js
(127.0.0.1) 0.92ms
[INFO] 2012-01-14 00:38:33,740: 200 GET
/static/platform/app/platform.dev.js (127.0.0.1) 1.16ms
[INFO] 2012-01-14 00:38:34,135: 200 GET /static/images/clock_32.png
(127.0.0.1) 0.75ms
[INFO] 2012-01-14 00:38:34,199: 200 GET /news/microposts/all/
(127.0.0.1) 63.27ms
[INFO] 2012-01-14 00:38:34,200: 200 GET
/static/css/images/ui-bg_glass_40_111111_1x400.png (127.0.0.1) 0.65ms
[INFO] 2012-01-14 00:38:34,201: 200 GET
/static/css/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png
(127.0.0.1) 0.60ms
[INFO] 2012-01-14 00:38:34,245: Long polling incoming
[INFO] 2012-01-14 00:38:35,149: 200 GET /favicon.ico (127.0.0.1) 0.76ms
[INFO] 2012-01-14 00:39:24,190: Long polling incoming
[ERROR] 2012-01-16 04:11:32,342: Exception after headers written
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/web.py",
line 897, in wrapper
return callback(*args, **kwargs)
File "../newebe/news/handlers.py", line 51, in on_new_post
self.finish()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/web.py",
line 641, in finish
self.request.finish()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/httpserver.py",
line 418, in finish
self.connection.finish()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/httpserver.py",
line 186, in finish
self._finish_request()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/httpserver.py",
line 220, in _finish_request
self.stream.read_until(b("\r\n\r\n"), self._header_callback)
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/iostream.py",
line 160, in read_until
self._check_closed()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/iostream.py",
line 504, in _check_closed
raise IOError("Stream is closed")
IOError: Stream is closed
[ERROR] 2012-01-16 04:11:32,346: Exception after headers written
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/web.py",
line 897, in wrapper
return callback(*args, **kwargs)
File "../newebe/news/handlers.py", line 51, in on_new_post
self.finish()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/web.py",
line 641, in finish
self.request.finish()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/httpserver.py",
line 418, in finish
self.connection.finish()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/httpserver.py",
line 186, in finish
self._finish_request()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/httpserver.py",
line 220, in _finish_request
self.stream.read_until(b("\r\n\r\n"), self._header_callback)
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/iostream.py",
line 160, in read_until
self._check_closed()
File "/usr/lib/python2.7/site-packages/tornado-2.1.1-py2.7.egg/tornado/iostream.py",
line 504, in _check_closed
raise IOError("Stream is closed")
IOError: Stream is closed
[INFO] 2012-01-16 04:11:32,346: Micropost from Pierre recieved
[INFO] 2012-01-16 04:11:32,347: 201 POST /news/microposts/contacts/
(82.244.52.176) 208.73ms
[INFO] 2012-01-16 06:01:55,414: Micropost from aurelien recieved
[INFO] 2012-01-16 06:01:55,415: 201 POST /news/microposts/contacts/
(87.50.19.150) 503.49ms
Some of the log entries do contain a (127.0.0.1), still, no?
The machine that hosts the Newebe instance is remote, and has IP
address beginning 97.
The machine from which I browse normally has an IP address of 142.*.
The reverse proxy which is connecting to the Newebe instance is local
to the Newebe instance, and connects via IP 127.0.0.1. However, it
uses the "X-Fowarded-For" header, which is intended to indicate to
Newebe the IP address of the client of behalf of which the proxy is
connecting. The Newebe instance definitely receives the connection
from the proxy, and not directly from my client.
Whether it fails or succeeds all the time depends on the details of
the code. One would expect working code to fail or succeed all the
time, yes.