Skip to content

Commit b442cc5

Browse files
isak-jakobssonjohan-hultberg-work
authored andcommitted
web-server: Document reverse proxy configuration
1 parent f122d11 commit b442cc5

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

web-server/README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
*Copyright (C) 2021, Axis Communications AB, Lund, Sweden. All Rights Reserved.*
22

3-
# Serve HTTP requests in an ACAP application
3+
# Serve HTTP requests through reverse proxy
44

55
This 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)
77
configuration, where HTTP requests to the application are routed to a web server
8-
[Monkey](https://github.com/monkey/monkey) running in the ACAP application and
9-
acting as a CGI.
8+
[Monkey](https://github.com/monkey/monkey) running inside the ACAP application
9+
and acting as a CGI.
10+
11+
The advantage of a webserver proxy is that when porting existing code to your
12+
ACAP application, its request handling can remain largely unmodified. This eases
13+
the task of sharing code between platforms. The webserver proxy method enforces
14+
a URL routing scheme as follows:
15+
16+
`http://<AXIS_DEVICE_IP>/local/<appName>/<apiPath>`
17+
18+
With `<appName>` and `<apiPath>` as defined in the manifest.
19+
20+
Note that this example shows the reverse proxy concept using Monkey, but you are
21+
free to use any webserver of your choice.
1022

1123
## Alternative approach
1224

@@ -27,6 +39,12 @@ application. In `manifest.json` under `configuration`, it is possible to specify
2739
a `settingPage` and a `reverseProxy` where the latter will connect the Monkey
2840
server to the Apache server.
2941

42+
Prior to manifest 1.5.0, reverse proxy was only supported through the
43+
postinstall script. The manifest based method is more strict on URLs in order to
44+
avoid name clashes that could occur in the old mechanism. When upgrading, your
45+
URLs will change to the format shown in
46+
[Serve HTTP requests through reverse proxy](#serve-http-requests-through-reverse-proxy).
47+
3048
The web server running in the ACAP application can also be exposed directly to
3149
the network by allowing external access to the port in the network
3250
configuration for the device. There are disadvantages with exposing Web
@@ -68,7 +86,7 @@ web-server
6886
6987
- Apache Reverse Proxy can not translate content with absolute addresses (i.e.
7088
/image.png) in the HTML page. Use only relative content (i.e. image.png or
71-
../image.png)). More information how to handle relative URLs correctly with a
89+
../image.png). More information how to handle relative URLs correctly with a
7290
reverse proxy
7391
[here](https://serverfault.com/questions/561892/how-to-handle-relative-urls-correctly-with-a-reverse-proxy).
7492
@@ -145,11 +163,6 @@ As can be seen it's HTML code, browse to web page
145163
`http://<AXIS_DEVICE_IP>/local/web_server_rev_proxy/my_web_server`
146164
for seeing it rendered.
147165
148-
> [!NOTE]
149-
>
150-
> - The API path is `<AXIS_DEVICE_IP>/local/<appName>/<apiPath>` where
151-
> `appName` and `apiPath` are fields from `manifest.json`.
152-
153166
The application log can be found by either
154167
155168
- Browse to `http://<AXIS_DEVICE_IP>/axis-cgi/admin/systemlog.cgi?appname=web_server_rev_proxy`.

0 commit comments

Comments
 (0)