diff --git a/mongoose.c b/mongoose.c
index b04acc4acb77d095e2061ea3c1cec1bce6f1d105..46a338f88bf4dfd4e3ed09ae15d40de62eceb837 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -667,6 +667,8 @@ static void cry(struct mg_connection *conn, const char *fmt, ...) {
 static struct mg_connection *fc(struct mg_context *ctx) {
   static struct mg_connection fake_connection;
   fake_connection.ctx = ctx;
+  // See https://github.com/cesanta/mongoose/issues/236
+  fake_connection.request_info.user_data = ctx->user_data;
   return &fake_connection;
 }