Based on the open source projects openwrt and luci for secondary development, set up uhttpd to separate requests from front and back ends across domains, and solve related problems such as web inability to access Access denied after openwrt starts

Based on the open source projects openwrt and luci for secondary development, set up uhttpd to separate requests from front and back ends across domains, and solve related problems such as web inability to access Access denied after openwrt starts.

After installing through the official compiled file, the browser will log in to view, similar to the following:
insert image description here
insert image description here

If you want to call related API requests in luci in other front-end projects, you may encounter the following problems:

insert image description here

Example of API request parameters:

insert image description here

uhttpd enables cross-domain access

What is cross domain access

For security reasons, browsers restrict cross-domain access (CORS) requests initiated from page scripts. At this time, pages can only access resources of the same origin, and CORS allows browsers to send XMLHttpRequest requests to cross-domain servers, thereby Realize cross-domain access.

Browsers divide CORS requests into two categories: simple requests and non-simple requests.

When the request meets the following three conditions at the same time, the CORS verification mechanism will use the simple mode for processing.

1. The request method is one of the following:
GET
HEAD
POS

Guess you like

Origin blog.csdn.net/u014374009/article/details/132319544