Two solutions for customizing web pages in OpenWrt:
- using the new web server process lighttpd+custom management page (not covered in this article)
- uhttpd OpenWRT native web server+custom management page+ubus rpc;
This article focuses on the second solution: uhttpd+custom web page+ubus rpc
As a native web server of OpenWRT, uhtpd, combined with Luci, can quickly add new feature pages under the native OpenWRT page. However, due to this framework, the presentation of OpenWRT native pages is relatively limited. Below, we will focus on how to support custom OpenWRT management pages on uhttpd;
Principle: Openwrt uhttpd has a built-in uhttpd mod ubus plugin that runs the HTTP protocol to call the ubus rpc function. When accessing/ubus in uhttpd, the first step is to determine whether the visitor has permission.
Customize the login page login.HTML and confirm the legal permissions through ubus rpc. Example:
Web page code