55This example demonstrates how to setup the Axis device web server (Apache) in a
66[ Reverse Proxy] ( https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html )
77configuration, where HTTP requests to the application are routed to a web server
8- [ Monkey ] ( https://github.com/monkey/monkey ) running inside the ACAP application
8+ [ CivetWeb ] ( https://github.com/civetweb/civetweb ) running inside the ACAP application
99and acting as a CGI.
1010
1111The advantage of a webserver proxy is that when porting existing code to your
@@ -17,7 +17,7 @@ a URL routing scheme as follows:
1717
1818With ` <appName> ` and ` <apiPath> ` as defined in the manifest.
1919
20- Note that this example shows the reverse proxy concept using Monkey , but you are
20+ Note that this example shows the reverse proxy concept using CivetWeb , but you are
2121free to use any webserver of your choice.
2222
2323## Alternative approach
@@ -36,7 +36,7 @@ route the requests to a web server running in the ACAP application.
3636
3737The Apache server is configured using the ` manifest.json ` file in an ACAP
3838application. In ` manifest.json ` under ` configuration ` , it is possible to specify
39- a ` settingPage ` and a ` reverseProxy ` where the latter will connect the Monkey
39+ a ` settingPage ` and a ` reverseProxy ` where the latter will connect the CivetWeb
4040server to the Apache server.
4141
4242Prior to manifest 1.5.0, reverse proxy was only supported through the
@@ -51,21 +51,15 @@ configuration for the device. There are disadvantages with exposing Web
5151Server directly to the network such as non standard ports and no reuse of
5252authentication, TLS and other features that comes with Apache Server.
5353
54- ## Monkey web server
54+ ## CivetWeb web server
5555
56- Monkey is a fast and lightweight web server for Linux. It has been designed to
57- be very scalable with low memory and CPU consumption, the perfect solution for
58- Embedded Linux and high end production environments. Besides the common
59- features as HTTP server, it expose a flexible C API which aims to behave as a
60- fully HTTP development framework, so it can be extended as desired through the
61- plugins interface. The Monkey Web Server
62- [ documentation] ( https://github.com/monkey/monkey-docs/ ) describes the
63- configuration in detail.
64-
65- > [ !NOTE]
66- > The main license of the Monkey repository is Apache, but some files
67- > are licensed under other types such as GPL. Make sure to control how it
68- > affects your application in order to be compliant.
56+ CivetWeb is an embeddable C web server for Linux. It is a great solution
57+ for running a web server on embedded Linux. Apart from being a
58+ HTTP server, it has a C API which can be extended as desired. The CivetWeb Web
59+ Server [ documentation] ( https://github.com/civetweb/civetweb/ ) describes the
60+ configuration in detail. CivetWeb is open source, and will contain different
61+ licenses depending on the features you build it with. Please see
62+ [ CivetWeb's repository] ( https://github.com/civetweb/civetweb/ ) for more information.
6963
7064## Getting started
7165
@@ -75,13 +69,17 @@ structure used in the example:
7569``` sh
7670web-server
7771├── app
78- │ ├── LICENSE - Text file which lists all open source licensed source code distributed with the application
79- │ └── manifest.json - Defines the application and its configuration
80- ├── Dockerfile - Docker file with the specified Axis container image to build the example specified
81- ├── monkey.patch - Patch for using monkey examples in a native ACAP
82- └── README.md - Step by step instructions on how to run the example
72+ │ ├── LICENSE
73+ │ └── manifest.json
74+ ├── Dockerfile
75+ └── README.md
8376```
8477
78+ - ** app/LICENSE** - Lists open source licensed source code in the application.
79+ - ** app/manifest.json** - Defines the application and its configuration.
80+ - ** Dockerfile** - Builds an Axis container image and the specified example.
81+ - ** README.md** - Step by step instructions on how to run the example.
82+
8583## Limitations
8684
8785- Apache Reverse Proxy can not translate content with absolute addresses (i.e.
@@ -102,7 +100,8 @@ Standing in your working directory run the following commands:
102100
103101> [ !NOTE]
104102>
105- > Depending on the network your local build machine is connected to, you may need to add proxy
103+ > Depending on the network your local build machine is connected to,
104+ you may need to add proxy
106105> settings for Docker. See
107106> [ Proxy in build time] ( https://developer.axis.com/acap/develop/proxy/#proxy-in-build-time ) .
108107
@@ -148,9 +147,23 @@ http://<AXIS_DEVICE_IP>/index.html#apps
148147A user can make a HTTP request to the application API using e.g. ` curl `
149148
150149``` sh
151- curl -u< USER> :< PASSWORD> --anyauth http://< AXIS_DEVICE_IP> /local/web_server_rev_proxy/my_web_server
152- < html><body><h1> ACAP application with reverse proxy web server< /h1><pre><br> Application name: web_server_rev_proxy< br> Reverse proxy path: /local/web_server_rev_proxy/my_web_server< br> Request timestamp: Fri Jan 24 14:54:47 2025
153- < /pre></body></html>
150+ curl -u < USER> :< PASSWORD> --anyauth http://< AXIS_DEVICE_IP> /local/web_server_rev_proxy/my_web_server
151+ ```
152+
153+ Where the expected output is
154+
155+ ``` sh
156+ < html>
157+ < head><link rel=" stylesheet" href=" style.css" /></head>
158+ < title>
159+ ACAP Web Server Example
160+ < /title>
161+ < body>
162+ < h1> ACAP Web Server Example< /h1>
163+ Welcome to the web server example, this server is based on the
164+ < a href=" https://github.com/civetweb/civetweb" > CivetWeb< /a> C library.
165+ < /body>
166+ < /html>
154167```
155168
156169As can be seen it's HTML code, browse to web page
0 commit comments