diff --git a/webserver/src/lwip/src/apps/http/httpd.c b/webserver/src/lwip/src/apps/http/httpd.c
index 8be9aab..45f21f9 100644
--- a/webserver/src/lwip/src/apps/http/httpd.c
+++ b/webserver/src/lwip/src/apps/http/httpd.c
@@ -253,6 +253,9 @@ struct http_state {
 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
   u8_t keepalive;
 #endif /* LWIP_HTTPD_SUPPORT_11_KEEPALIVE */
+#if LWIP_HTTPD_SUPPORT_AUTH_COOKIE
+  char *auth_cookie_value;
+#endif /* LWIP_HTTPD_SUPPORT_AUTH_COOKIE */
 #if LWIP_HTTPD_SSI
   struct http_ssi_state *ssi;
 #endif /* LWIP_HTTPD_SSI */
@@ -2055,6 +2058,27 @@ http_parse_request(struct pbuf *inp, struct http_state *hs, struct altcp_pcb *pc
             hs->keepalive = 0;
           }
 #endif /* LWIP_HTTPD_SUPPORT_11_KEEPALIVE */
+#if LWIP_HTTPD_SUPPORT_AUTH_COOKIE
+          /* Search for Auth cookie */
+          const char cookie_prefix[] = CRLF "Cookie: " HTTP_AUTH_COOKIE_NAME "=";
+          char *auth_cookie = lwip_strnstr(data, cookie_prefix, data_len);
+          if (auth_cookie != NULL) {
+            auth_cookie += strlen(cookie_prefix);
+            data_len -= (auth_cookie - data);
+            /* Cookie value ends with ';' or CRLF */
+            char *cookie_end;
+            cookie_end = lwip_strnstr(auth_cookie, ";", data_len);
+            if (cookie_end == NULL) {
+                cookie_end = lwip_strnstr(auth_cookie, CRLF, data_len);
+            }
+            if (cookie_end != NULL) {
+                *cookie_end = '\0';
+                hs->auth_cookie_value = auth_cookie;
+            }
+          } else {
+            hs->auth_cookie_value = NULL;
+          }
+#endif /* LWIP_HTTPD_SUPPORT_AUTH_COOKIE */
           /* null-terminate the METHOD (pbuf is freed anyway wen returning) */
           *sp1 = 0;
           uri[uri_len] = 0;
@@ -2206,15 +2230,20 @@ http_find_file(struct http_state *hs, const char *uri, int is_09)
         file_name = httpd_default_filenames[loop].name;
       }
       LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Looking for %s...\n", file_name));
-      err = fs_open(&hs->file_handle, file_name);
-      if (err == ERR_OK) {
-        uri = file_name;
-        file = &hs->file_handle;
-        LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Opened.\n"));
+#if LWIP_HTTPD_SUPPORT_AUTH_COOKIE
+      if (httpd_authorized_for_uri(hs->auth_cookie_value, file_name))
+#endif  /* LWIP_HTTPD_SUPPORT_AUTH_COOKIE */
+      {
+        err = fs_open(&hs->file_handle, file_name);
+        if (err == ERR_OK) {
+          uri = file_name;
+          file = &hs->file_handle;
+          LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Opened.\n"));
 #if LWIP_HTTPD_SSI
-        tag_check = httpd_default_filenames[loop].shtml;
+          tag_check = httpd_default_filenames[loop].shtml;
 #endif /* LWIP_HTTPD_SSI */
-        break;
+          break;
+        }
       }
     }
   }
@@ -2249,6 +2278,15 @@ http_find_file(struct http_state *hs, const char *uri, int is_09)
 
     LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Opening %s\n", uri));
 
+#if LWIP_HTTPD_SUPPORT_AUTH_COOKIE
+    LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Check authorization for %s\n", uri));
+    if (!httpd_authorized_for_uri(hs->auth_cookie_value, uri)) {
+      LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Authorization failed, landing to %s\n", HTTP_LOGIN_FILE));
+      uri = HTTP_LOGIN_FILE;
+      params = NULL;        // Ignore any parameters in the query string
+    }
+#endif
+
     err = fs_open(&hs->file_handle, uri);
     if (err == ERR_OK) {
       file = &hs->file_handle;
@@ -2329,6 +2367,9 @@ http_init_file(struct http_state *hs, struct fs_file *file, int is_09, const cha
 #if defined(LWIP_HTTPD_FILE_STATE) && LWIP_HTTPD_FILE_STATE
                         , file->state
 #endif /* LWIP_HTTPD_FILE_STATE */
+#if defined(LWIP_HTTPD_SUPPORT_AUTH_COOKIE) && LWIP_HTTPD_SUPPORT_AUTH_COOKIE
+                        , hs->auth_cookie_value
+#endif /* LWIP_HTTPD_SUPPORT_AUTH_COOKIE */
                        );
     }
 #else /* LWIP_HTTPD_CGI_SSI */
diff --git a/webserver/src/lwip/src/include/lwip/apps/httpd.h b/webserver/src/lwip/src/include/lwip/apps/httpd.h
index 52002d7..17c39f7 100644
--- a/webserver/src/lwip/src/include/lwip/apps/httpd.h
+++ b/webserver/src/lwip/src/include/lwip/apps/httpd.h
@@ -99,6 +99,12 @@ void http_set_cgi_handlers(const tCGI *pCGIs, int iNumHandlers);
 
 #endif /* LWIP_HTTPD_CGI */
 
+#if LWIP_HTTPD_SUPPORT_AUTH_COOKIE
+
+extern signed char httpd_authorized_for_uri(const char *auth_cookie, const char *filename);
+
+#endif /* LWIP_HTTPD_SUPPORT_AUTH_COOKIE */
+
 #if LWIP_HTTPD_CGI || LWIP_HTTPD_CGI_SSI
 
 #if LWIP_HTTPD_CGI_SSI
@@ -116,6 +122,9 @@ extern void httpd_cgi_handler(struct fs_file *file, const char* uri, int iNumPar
 #if defined(LWIP_HTTPD_FILE_STATE) && LWIP_HTTPD_FILE_STATE
                                      , void *connection_state
 #endif /* LWIP_HTTPD_FILE_STATE */
+#if defined(LWIP_HTTPD_SUPPORT_AUTH_COOKIE) && LWIP_HTTPD_SUPPORT_AUTH_COOKIE
+                                     , const char *cookie
+#endif /* LWIP_HTTPD_SUPPORT_AUTH_COOKIE */
                                      );
 #endif /* LWIP_HTTPD_CGI_SSI */
 
