You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/reverse-proxy.rst
+41-34Lines changed: 41 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ If you are looking for the forward proxy, see :doc:`Forward Proxy <forward-proxy
9
9
Overview
10
10
--------
11
11
12
-
The caddy plugin currently supports two types of network listeners:
12
+
The Caddy plugin currently supports two types of network listeners:
13
13
14
14
- HTTP1.1/HTTP2.0 over SCION: The plugin can listen for incoming HTTP1.1/HTTP2.0 requests over a single-stream SCION connection.
15
15
@@ -25,41 +25,41 @@ Prerequisites
25
25
Installation
26
26
------------
27
27
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>`_.
29
29
30
30
31
31
Build for Linux
32
32
~~~~~~~~~~~~~~~
33
33
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:
35
35
36
36
- Download the source code from the `Caddy SCION repository <https://github.com/scionproto-contrib/caddy-scion>`_.
37
37
- Depending on what protocol the reverse proxy should support, you can build the binary with the following commands:
38
38
39
39
- Native HTTP3 support:
40
40
41
-
.. code-block:: bash
41
+
.. code-block:: bash
42
42
43
-
go build -o ./build/scion-caddy-native ./cmd/scion-caddy-native
43
+
go build -o ./build/scion-caddy-native ./cmd/scion-caddy-native
44
44
45
45
46
46
- HTTP1.1, HTTP2.0 and native HTTP3 over SCION:
47
47
48
-
.. code-block:: bash
48
+
.. code-block:: bash
49
49
50
-
go build -o ./build/scion-caddy-reverse ./cmd/scion-caddy-reverse
50
+
go build -o ./build/scion-caddy-reverse ./cmd/scion-caddy-reverse
51
51
52
52
53
53
Then, you can follow the steps below to install the plugin:
54
54
55
55
- Copy the binary to ``/usr/local/bin`` or any other directory in your ``$PATH``.
- 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>`__.
63
63
64
64
- The reverse proxy can work in two modes, `layer-5 <#layer-5-reverse-proxy>`__ or `layer-4 (passthrough) <#layer-4-reverse-proxy-passthrough>`__.
65
65
Check the corresponding sections to configure the reverse proxy accordingly.
@@ -71,25 +71,25 @@ Build for Windows
71
71
.. note::
72
72
Experimental option. The SCION HTTP reverse proxy has not been tested on Windows yet.
73
73
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:
75
75
76
76
- Download the source code from the `Caddy SCION repository <https://github.com/scionproto-contrib/caddy-scion>`_.
77
77
- Depending on what protocol the reverse proxy should support, you can build the binary with the following commands:
78
78
79
79
- Native HTTP3 support:
80
80
81
-
.. code-block:: bash
81
+
.. code-block:: bash
82
82
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
84
84
85
85
86
86
- HTTP1.1, HTTP2.0 and native HTTP3 over SCION:
87
87
88
-
.. code-block:: bash
88
+
.. code-block:: bash
89
89
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
91
91
92
-
Then, you follow the steps below:
92
+
Then, follow the steps below:
93
93
94
94
- 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>`_.
95
95
@@ -100,7 +100,7 @@ Then, you follow the steps below:
100
100
101
101
.. code-block:: bash
102
102
103
-
.\\scion-caddy run -conf \\path\\to\\your\\config.json
103
+
.\\scion-caddy run -conf \\path\\to\\your\\config.json
104
104
105
105
.. warning::
106
106
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
114
114
115
115
ISD-AS environment
116
116
~~~~~~~~~~~~~~~~~~
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.
118
118
You can specify a different location by setting the ``SCION_ENV_PATH`` environment variable. The file format is as follows:
119
119
120
120
.. code-block:: json
121
121
122
122
{
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>"
130
129
}
130
+
}
131
131
}
132
132
133
133
@@ -138,47 +138,54 @@ The SCION HTTP Reverse Proxy can act as a layer-5 reverse proxy, terminating the
138
138
In this case, the reverse proxy must provide the expected certificate for the specified domain.
139
139
Afterwards, it will forward the HTTP request to the backend server.
140
140
141
-
The plugin configuration for caddy is extended with:
141
+
The plugin configuration for Caddy is extended with:
- SCION network listener configuration, which is used to specify the SCION address and port to listen on, we extend with the following network names:
145
145
146
146
- ``scion``: The SCION network listener for native HTTP3 over SCION.
147
147
- ``scion+single-stream``: The SCION network listener for HTTP1.1/HTTP2.0 over SCION.
148
148
149
149
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``.
150
150
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.
152
152
For more information on how to configure Caddy, see the `Caddy documentation <https://caddyserver.com/docs/json/apps/http/>`_.
153
153
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
+
154
161
Layer-4 Reverse Proxy (Passthrough)
155
162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156
163
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.
157
164
In this case, the reverse proxy will not terminate the TLS connection, but will forward the TCP connection to the backend server.
158
165
159
166
This feature is enabled via the non-standard layer-4 module (see `Caddy layer-4 documentation <https://caddyserver.com/docs/json/apps/layer4>`_).
160
167
161
-
The plugin configuration for caddy is extended with:
168
+
The plugin configuration for Caddy is extended with:
162
169
163
170
- SCION network listener configuration, which is used to specify the SCION address and port to listen on, we extend with the following network names:
164
171
165
172
- ``scion+single-stream``: The SCION network listener for single-stream connection over SCION.
166
173
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.
168
175
For more information on how to configure Caddy, see the `Caddy layer-4 documentation <https://caddyserver.com/docs/json/apps/layer4>`_.
169
176
170
177
.. note::
171
178
Layer-4 reverse proxy for HTTP3 clients has not been tested yet.
172
179
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>`_.
174
181
175
182
Forward Proxy and Reverse Proxy ecosystem
176
183
-----------------------------------------
177
184
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.
0 commit comments