diff -ur nginx-1.2.7.orig/src/http/modules/ngx_http_limit_conn_module.c nginx-1.2.7/src/http/modules/ngx_http_limit_conn_module.c
--- nginx-1.2.7.orig/src/http/modules/ngx_http_limit_conn_module.c	2012-09-24 18:54:28.000000000 +0000
+++ nginx-1.2.7/src/http/modules/ngx_http_limit_conn_module.c	2013-03-05 18:02:00.991821567 +0000
@@ -40,6 +40,7 @@
 typedef struct {
     ngx_array_t         limits;
     ngx_uint_t          log_level;
+    ngx_uint_t          status_code;
 } ngx_http_limit_conn_conf_t;
 
 
@@ -73,6 +74,9 @@
     { ngx_null_string, 0 }
 };
 
+static ngx_conf_num_bounds_t  ngx_http_limit_conn_status_bounds = {
+    ngx_conf_check_num_bounds, 400, 599
+};
 
 static ngx_command_t  ngx_http_limit_conn_commands[] = {
 
@@ -104,6 +108,13 @@
       offsetof(ngx_http_limit_conn_conf_t, log_level),
       &ngx_http_limit_conn_log_levels },
 
+    { ngx_string("limit_conn_status"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_num_slot,
+      NGX_HTTP_LOC_CONF_OFFSET,
+      offsetof(ngx_http_limit_conn_conf_t, status_code),
+      &ngx_http_limit_conn_status_bounds },
+
       ngx_null_command
 };
 
@@ -138,7 +149,6 @@
     NGX_MODULE_V1_PADDING
 };
 
-
 static ngx_int_t
 ngx_http_limit_conn_handler(ngx_http_request_t *r)
 {
@@ -206,7 +216,7 @@
             if (node == NULL) {
                 ngx_shmtx_unlock(&shpool->mutex);
                 ngx_http_limit_conn_cleanup_all(r->pool);
-                return NGX_HTTP_SERVICE_UNAVAILABLE;
+                return lccf->status_code;
             }
 
             lc = (ngx_http_limit_conn_node_t *) &node->color;
@@ -231,7 +241,7 @@
                               &limits[i].shm_zone->shm.name);
 
                 ngx_http_limit_conn_cleanup_all(r->pool);
-                return NGX_HTTP_SERVICE_UNAVAILABLE;
+                return lccf->status_code;
             }
 
             lc->conn++;
@@ -467,6 +477,7 @@
      */
 
     conf->log_level = NGX_CONF_UNSET_UINT;
+    conf->status_code = NGX_CONF_UNSET_UINT;
 
     return conf;
 }
@@ -483,6 +494,7 @@
     }
 
     ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);
+    ngx_conf_merge_uint_value(conf->status_code, prev->status_code, NGX_HTTP_SERVICE_UNAVAILABLE);
 
     return NGX_CONF_OK;
 }
diff -ur nginx-1.2.7.orig/src/http/modules/ngx_http_limit_req_module.c nginx-1.2.7/src/http/modules/ngx_http_limit_req_module.c
--- nginx-1.2.7.orig/src/http/modules/ngx_http_limit_req_module.c	2012-09-24 19:11:45.000000000 +0000
+++ nginx-1.2.7/src/http/modules/ngx_http_limit_req_module.c	2013-03-05 18:01:03.682760351 +0000
@@ -53,6 +53,7 @@
     ngx_array_t                  limits;
     ngx_uint_t                   limit_log_level;
     ngx_uint_t                   delay_log_level;
+    ngx_uint_t                   status_code;
 } ngx_http_limit_req_conf_t;
 
 
@@ -83,6 +84,9 @@
     { ngx_null_string, 0 }
 };
 
+static ngx_conf_num_bounds_t  ngx_http_limit_req_status_bounds = {
+    ngx_conf_check_num_bounds, 400, 599
+};
 
 static ngx_command_t  ngx_http_limit_req_commands[] = {
 
@@ -107,6 +111,13 @@
       offsetof(ngx_http_limit_req_conf_t, limit_log_level),
       &ngx_http_limit_req_log_levels },
 
+    { ngx_string("limit_req_status"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_num_slot,
+      NGX_HTTP_LOC_CONF_OFFSET,
+      offsetof(ngx_http_limit_req_conf_t, status_code),
+      &ngx_http_limit_req_status_bounds },
+
       ngx_null_command
 };
 
@@ -141,7 +152,6 @@
     NGX_MODULE_V1_PADDING
 };
 
-
 static ngx_int_t
 ngx_http_limit_req_handler(ngx_http_request_t *r)
 {
@@ -245,7 +255,7 @@
             ctx->node = NULL;
         }
 
-        return NGX_HTTP_SERVICE_UNAVAILABLE;
+        return lrcf->status_code;
     }
 
     /* rc == NGX_AGAIN || rc == NGX_OK */
@@ -682,6 +692,7 @@
      */
 
     conf->limit_log_level = NGX_CONF_UNSET_UINT;
+    conf->status_code     = NGX_CONF_UNSET_UINT;
 
     return conf;
 }
@@ -703,6 +714,8 @@
     conf->delay_log_level = (conf->limit_log_level == NGX_LOG_INFO) ?
                                 NGX_LOG_INFO : conf->limit_log_level + 1;
 
+    ngx_conf_merge_uint_value(conf->status_code, prev->status_code, NGX_HTTP_SERVICE_UNAVAILABLE);
+
     return NGX_CONF_OK;
 }
 
