From d9ecc501194e9067eda5c0f457a85950e9988805 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sun, 5 Oct 2014 08:55:28 -0400 Subject: [PATCH] since the management server binds to 127.0.0.1, must use that and not 'localhost' to connect to it because 'localhost' resolves to the IPv6 ::1 when it is available, see #224 --- conf/nginx-primaryonly.conf | 4 +++- management/daemon.py | 1 + tools/mail.py | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index 321194a..56307ee 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -1,7 +1,9 @@ # Control Panel + # Proxy /admin to our Python based control panel daemon. It is + # listening on IPv4 only so use an IP address and not 'localhost'. rewrite ^/admin$ /admin/; location /admin/ { - proxy_pass http://localhost:10222/; + proxy_pass http://127.0.0.1:10222/; proxy_set_header X-Forwarded-For $remote_addr; } diff --git a/management/daemon.py b/management/daemon.py index 61e5545..13b6693 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -278,5 +278,6 @@ if __name__ == '__main__': # debug console and enter that as the username app.logger.info('API key: ' + auth_service.key) + # Start the application server. Listens on 127.0.0.1 (IPv4 only). app.run(port=10222) diff --git a/tools/mail.py b/tools/mail.py index aac5ef7..0fd89d2 100755 --- a/tools/mail.py +++ b/tools/mail.py @@ -3,7 +3,8 @@ import sys, getpass, urllib.request, urllib.error, json def mgmt(cmd, data=None, is_json=False): - mgmt_uri = 'http://localhost:10222' + # The base URL for the management daemon. (Listens on IPv4 only.) + mgmt_uri = 'http://127.0.0.1:10222' setup_key_auth(mgmt_uri)