diff --git a/changelog b/changelog
index 75565bf3f26ac91ea9e16bb5e84e58e1e197ec80..e2f56f0d9e57e88867b6a8bbe668f42d3b944ba7 100644
--- a/changelog
+++ b/changelog
@@ -48,6 +48,8 @@ Extra optional argument to libwebsockets_serve_http_file() allows injecion
 of HTTP headers into the canned response.  Eg, cookies may be added like
 that without getting involved in having to send the header by hand.
 
+A new info member http_proxy_address may be used at context creation time to
+set the http proxy.  If non-NULL, it overrides http_proxy environment var.
 
 
 v1.23-chrome32-firefox24
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index f0a09fdc3269088f9f5552726903adb0f7c8383a..28d798b24800717ac2e995c51734b5748bde9b40 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -2090,21 +2090,31 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
 
 	/* split the proxy ads:port if given */
 
-	p = getenv("http_proxy");
-	if (p) {
-		strncpy(context->http_proxy_address, p,
+	if (info->http_proxy_address) {
+		strncpy(context->http_proxy_address, info->http_proxy_address,
 				      sizeof(context->http_proxy_address) - 1);
 		context->http_proxy_address[
 				sizeof(context->http_proxy_address) - 1] = '\0';
-
-		p = strchr(context->http_proxy_address, ':');
-		if (p == NULL) {
-			lwsl_err("http_proxy needs to be ads:port\n");
-			goto bail;
+		context->http_proxy_port = info->http_proxy_port;
+	} else {
+		p = getenv("http_proxy");
+		if (p) {
+			strncpy(context->http_proxy_address, p,
+					      sizeof(context->http_proxy_address) - 1);
+			context->http_proxy_address[
+					sizeof(context->http_proxy_address) - 1] = '\0';
+
+			p = strchr(context->http_proxy_address, ':');
+			if (p == NULL) {
+				lwsl_err("http_proxy needs to be ads:port\n");
+				goto bail;
+			}
+			*p = '\0';
+			context->http_proxy_port = atoi(p + 1);
 		}
-		*p = '\0';
-		context->http_proxy_port = atoi(p + 1);
+	}
 
+	if (context->http_proxy_address[0]) {
 		lwsl_notice(" Proxy %s:%u\n",
 				context->http_proxy_address,
 						      context->http_proxy_port);
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index 24856a499078c29314252f2e4a29bf22e582e98a..a7c07aaa0ced1cb4b202f1c874f17737f281eaa0 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -938,6 +938,8 @@ struct lws_context_creation_info {
 	const char *ssl_private_key_filepath;
 	const char *ssl_ca_filepath;
 	const char *ssl_cipher_list;
+	const char *http_proxy_address;
+	unsigned int http_proxy_port;
 	int gid;
 	int uid;
 	unsigned int options;