Skip to content

Commit 2041c30

Browse files
authored
doc: reverse: add listen_protocols information (#17)
* fix _examples links * add listening protocol information * typos
1 parent 14abf6c commit 2041c30

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

docs/source/reverse-proxy.rst

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ If you are looking for the forward proxy, see :doc:`Forward Proxy <forward-proxy
99
Overview
1010
--------
1111

12-
The caddy plugin currently supports two types of network listeners:
12+
The Caddy plugin currently supports two types of network listeners:
1313

1414
- HTTP1.1/HTTP2.0 over SCION: The plugin can listen for incoming HTTP1.1/HTTP2.0 requests over a single-stream SCION connection.
1515

@@ -25,41 +25,41 @@ Prerequisites
2525
Installation
2626
------------
2727

28-
You can install the SCION HTTP Reverse Proxy building it for the target platform or downloading the pre-built binary in `releases <https://github.com/scionproto-contrib/caddy-scion/releases>`_.
28+
You can install the SCION HTTP Reverse Proxy by building it for the target platform or downloading the pre-built binary in `releases <https://github.com/scionproto-contrib/caddy-scion/releases>`_.
2929

3030

3131
Build for Linux
3232
~~~~~~~~~~~~~~~
3333

34-
You can build the caddy server containing the SCION plugin from source as follows:
34+
You can build the Caddy server containing the SCION plugin from source as follows:
3535

3636
- Download the source code from the `Caddy SCION repository <https://github.com/scionproto-contrib/caddy-scion>`_.
3737
- Depending on what protocol the reverse proxy should support, you can build the binary with the following commands:
3838

3939
- Native HTTP3 support:
4040

41-
.. code-block:: bash
41+
.. code-block:: bash
4242
43-
go build -o ./build/scion-caddy-native ./cmd/scion-caddy-native
43+
go build -o ./build/scion-caddy-native ./cmd/scion-caddy-native
4444
4545
4646
- HTTP1.1, HTTP2.0 and native HTTP3 over SCION:
4747

48-
.. code-block:: bash
48+
.. code-block:: bash
4949
50-
go build -o ./build/scion-caddy-reverse ./cmd/scion-caddy-reverse
50+
go build -o ./build/scion-caddy-reverse ./cmd/scion-caddy-reverse
5151
5252
5353
Then, you can follow the steps below to install the plugin:
5454

5555
- Copy the binary to ``/usr/local/bin`` or any other directory in your ``$PATH``.
5656
- Add network capabilities to the binary:
5757

58-
.. code-block:: bash
58+
.. code-block:: bash
5959
60-
sudo setcap cap_net_bind_service=+ep /usr/local/bin/scion-caddy
60+
sudo setcap cap_net_bind_service=+ep /usr/local/bin/scion-caddy
6161
62-
- Optionally you can create a systemd service and enable it. You can use the example service file ``scion-caddy.service`` in the `examples <https://github.com/scionproto-contrib/http-proxy/tree/main/_examples>`__.
62+
- Optionally, you can create a systemd service and enable it. You can use the example service file ``scion-caddy.service`` in the `examples <https://github.com/scionproto-contrib/caddy-scion/tree/main/_examples>`__.
6363

6464
- The reverse proxy can work in two modes, `layer-5 <#layer-5-reverse-proxy>`__ or `layer-4 (passthrough) <#layer-4-reverse-proxy-passthrough>`__.
6565
Check the corresponding sections to configure the reverse proxy accordingly.
@@ -71,25 +71,25 @@ Build for Windows
7171
.. note::
7272
Experimental option. The SCION HTTP reverse proxy has not been tested on Windows yet.
7373

74-
You can build the caddy server containing the SCION plugin from source as follows:
74+
You can build the Caddy server containing the SCION plugin from source as follows:
7575

7676
- Download the source code from the `Caddy SCION repository <https://github.com/scionproto-contrib/caddy-scion>`_.
7777
- Depending on what protocol the reverse proxy should support, you can build the binary with the following commands:
7878

7979
- Native HTTP3 support:
8080

81-
.. code-block:: bash
81+
.. code-block:: bash
8282
83-
GOOS=windows GOARCH=amd64 go build -o ./build/scion-caddy-native ./cmd/scion-caddy-native
83+
GOOS=windows GOARCH=amd64 go build -o ./build/scion-caddy-native ./cmd/scion-caddy-native
8484
8585
8686
- HTTP1.1, HTTP2.0 and native HTTP3 over SCION:
8787

88-
.. code-block:: bash
88+
.. code-block:: bash
8989
90-
GOOS=windows GOARCH=amd64 go build -o ./build/scion-caddy-reverse ./cmd/scion-caddy-reverse
90+
GOOS=windows GOARCH=amd64 go build -o ./build/scion-caddy-reverse ./cmd/scion-caddy-reverse
9191
92-
Then, you follow the steps below:
92+
Then, follow the steps below:
9393

9494
- Ensure that you are running the scion-endhost stack as described in the `SCION documentation <https://docs.scion.org/projects/scion-applications/en/latest/applications/access.html>`_.
9595

@@ -100,7 +100,7 @@ Then, you follow the steps below:
100100

101101
.. code-block:: bash
102102
103-
.\\scion-caddy run -conf \\path\\to\\your\\config.json
103+
.\\scion-caddy run -conf \\path\\to\\your\\config.json
104104

105105
.. warning::
106106
The SCION endhost stack is not officially supported on Windows, but it can be built and run with some limitations.
@@ -114,20 +114,20 @@ One can enable two modes of operation: layer-5 reverse proxy and layer-4 reverse
114114

115115
ISD-AS environment
116116
~~~~~~~~~~~~~~~~~~
117-
The SCION HTTP Reverse Proxy can be configured to serve resources for different ISD-ASes. Those are configured in ``/etc/scion/environment.json`` file.
117+
The SCION HTTP Reverse Proxy can be configured to serve resources for different ISD-ASes. Those are configured in the ``/etc/scion/environment.json`` file.
118118
You can specify a different location by setting the ``SCION_ENV_PATH`` environment variable. The file format is as follows:
119119

120120
.. code-block:: json
121121
122122
{
123-
"ases": {
124-
"<ISD-AS>": {
125-
"daemon_address": "<IP>:<Port>"
126-
},
127-
"<ISD-AS>": {
128-
"daemon_address": "<IP>:<Port>"
129-
}
123+
"ases": {
124+
"<ISD-AS>": {
125+
"daemon_address": "<IP>:<Port>"
126+
},
127+
"<ISD-AS>": {
128+
"daemon_address": "<IP>:<Port>"
130129
}
130+
}
131131
}
132132
133133
@@ -138,47 +138,54 @@ The SCION HTTP Reverse Proxy can act as a layer-5 reverse proxy, terminating the
138138
In this case, the reverse proxy must provide the expected certificate for the specified domain.
139139
Afterwards, it will forward the HTTP request to the backend server.
140140

141-
The plugin configuration for caddy is extended with:
141+
The plugin configuration for Caddy is extended with:
142142

143-
- ``scion module`` <https://caddyserver.com/docs/modules/scion>`_
143+
- ``scion module`` `<https://caddyserver.com/docs/modules/scion>`_
144144
- SCION network listener configuration, which is used to specify the SCION address and port to listen on, we extend with the following network names:
145145

146146
- ``scion``: The SCION network listener for native HTTP3 over SCION.
147147
- ``scion+single-stream``: The SCION network listener for HTTP1.1/HTTP2.0 over SCION.
148148

149149
The address follows the `network address convention <https://caddyserver.com/docs/conventions#network-addresses>`_ for Caddy, e.g., ``scion/[1-ff00:0:112,127.0.0.1]:8443`` or ``scion+single-stream/[1-ff00:0:112,127.0.0.1]:7443``.
150150

151-
One can follow the example in `examples <https://github.com/scionproto-contrib/http-proxy/tree/main/_examples/reverse.json>`__ to configure the reverse proxy to serve specific domains in this mode.
151+
You can follow the example in `examples <https://github.com/scionproto-contrib/caddy-scion/tree/main/_examples/reverse.json>`__ to configure the reverse proxy to serve specific domains in this mode.
152152
For more information on how to configure Caddy, see the `Caddy documentation <https://caddyserver.com/docs/json/apps/http/>`_.
153153

154+
It is important to configure the HTTP protocols consistently using the ``listen_protocols`` `option <https://caddyserver.com/docs/json/apps/http/servers/listen_protocols/>`_ in the Caddy JSON config.
155+
The possible combinations are (one can configure one or several out of the following protocols for each listener):
156+
157+
- ``[h3]`` for the ``scion`` listener.
158+
- ``[h1, h2]`` for the ``scion+single-stream`` listener.
159+
- ``[h1, h2, h3]`` for regular HTTP listeners.
160+
154161
Layer-4 Reverse Proxy (Passthrough)
155162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156163
If TLS termination option is not desirable due to the setup, the SCION HTTP Reverse Proxy can act as a layer-4 reverse proxy, forwarding the TCP connection to the backend server.
157164
In this case, the reverse proxy will not terminate the TLS connection, but will forward the TCP connection to the backend server.
158165

159166
This feature is enabled via the non-standard layer-4 module (see `Caddy layer-4 documentation <https://caddyserver.com/docs/json/apps/layer4>`_).
160167

161-
The plugin configuration for caddy is extended with:
168+
The plugin configuration for Caddy is extended with:
162169

163170
- SCION network listener configuration, which is used to specify the SCION address and port to listen on, we extend with the following network names:
164171

165172
- ``scion+single-stream``: The SCION network listener for single-stream connection over SCION.
166173

167-
One can follow the example in the `examples <https://github.com/scionproto-contrib/http-proxy/tree/main/_examples/passthrough_scionlab.json>`__ to configure the reverse proxy to serve specific domains in this mode.
174+
You can follow the example in the `examples <https://github.com/scionproto-contrib/caddy-scion/tree/main/_examples/passthrough_scionlab.json>`__ to configure the reverse proxy to serve specific domains in this mode.
168175
For more information on how to configure Caddy, see the `Caddy layer-4 documentation <https://caddyserver.com/docs/json/apps/layer4>`_.
169176

170177
.. note::
171178
Layer-4 reverse proxy for HTTP3 clients has not been tested yet.
172179
One may try to use the "scion" network listener with the layer-4 module to achieve this, especially in combination with ``layer4.matchers.quic``.
173-
For more information you can check `Caddy layer-4 github repo <https://github.com/mholt/caddy-l4?tab=readme-ov-file#introduction>`_.
180+
For more information, you can check `Caddy layer-4 github repo <https://github.com/mholt/caddy-l4?tab=readme-ov-file#introduction>`_.
174181

175182
Forward Proxy and Reverse Proxy ecosystem
176183
-----------------------------------------
177184

178-
The SCION HTTP Reverse Proxy can be used in combination with the `SCION Forward Proxy <forward-proxy>` to provide a SCION browsing experience.
185+
The SCION HTTP Reverse Proxy can be used in combination with the `SCION Forward Proxy <forward-proxy>`_ to provide a SCION browsing experience.
179186
The figure below shows the enabled ecosystem.
180187

181188
.. _reverse-proxy-figure:
182189
.. image:: img/https_combinations.png
183-
:alt: SCION HTTP Reverse Proxy Diagram
184-
:align: center
190+
:alt: SCION HTTP Reverse Proxy Diagram
191+
:align: center

0 commit comments

Comments
 (0)