Skip to content

Commit b82f403

Browse files
committed
doc: document custom path image
1 parent 8e422d0 commit b82f403

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

doc/custom-path.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Using a custom path for LiT
2+
3+
If required LiT can be built to be accessed through a custom path (e.g. `/lit/`)
4+
in the browser instead of the default root path (`/`).
5+
6+
To build LiT with a custom path, run the following command:
7+
8+
```shell
9+
⛰ make PUBLIC_URL=/my-custom-path
10+
```
11+
12+
**Make sure to not include a `/` at the end of the path.** To revert to the
13+
original, root path, set the variable to empty (`make PUBLIC_URL=`) or leave
14+
it out completely.
15+
16+
## Docker image built with a path prefix
17+
18+
There is a docker image that's automatically built with the prefix `/lit`
19+
available on Docker Hub. Just append `-path-prefix` to any version tag (after
20+
`v0.5.2-alpha`). For example:
21+
22+
```shell
23+
# Default image.
24+
⛰ docker pull lightninglabs/lightning-terminal:v0.5.3-alpha
25+
26+
# Image with /lit path prefix.
27+
⛰ docker pull lightninglabs/lightning-terminal:v0.5.3-alpha-path-prefix
28+
```
29+
30+
## Use with nginx reverse proxy
31+
32+
There is [an example nginx](example-nginx.conf) config file that demonstrates
33+
how rewrite rules can be set up to run LiT under the `/lit` path prefix (and
34+
internally forward all `grpc-web` requests to the LiT proxy while still
35+
forwarding "native" gRPC requests to the `lnd` instance that's also running
36+
behind the nginx reverse proxy).
37+
38+
The example reverse proxy can be run with:
39+
40+
```shell
41+
cd docs
42+
⛰ docker run --name lit-nginx \
43+
-v $(pwd)/example-nginx.conf:/etc/nginx/nginx.conf:ro -p 8081:80 -d nginx
44+
```

doc/example-nginx.conf

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
events {
2+
worker_connections 1024;
3+
}
4+
5+
http {
6+
# Redirect all incoming grpc-web requests to the LiT proxy. Everything else
7+
# goes directly to the internal lnd container. We use a temporary variable
8+
# here so we can rewrite it to the actual host again in the next map
9+
# directive.
10+
map $content_type $tmp_backend {
11+
"application/grpc-web+proto" "172.17.0.1:8443"; # LiT proxy.
12+
default "localhost:10009"; # main LND
13+
}
14+
15+
# Streaming grpc-web requests can be identified by the
16+
# "Sec-WebSocket-Protocol: grpc-websockets" header field. So those requests
17+
# also need to go to the LiT proxy.
18+
map $http_sec_websocket_protocol $lnd_backend {
19+
"grpc-websockets" "172.17.0.1:8443"; # LiT proxy.
20+
default $tmp_backend; # Fall back to the value from the above map result.
21+
}
22+
23+
# Make sure WebSockets are properly upgraded.
24+
map $http_sec_websocket_protocol $lnd_connection {
25+
"grpc-websockets" "upgrade";
26+
default $http_connection;
27+
}
28+
29+
server {
30+
listen 80;
31+
server_name localhost;
32+
33+
proxy_set_header Upgrade $http_upgrade;
34+
proxy_set_header Origin https://$lnd_backend;
35+
proxy_set_header Connection $lnd_connection;
36+
37+
location /lit {
38+
# This needs a slash at the end!
39+
proxy_pass https://172.17.0.1:8443/;
40+
}
41+
42+
location ~* ^/lnrpc.Lightning/ {
43+
# This cannot have a slash at the end!
44+
proxy_pass https://$lnd_backend;
45+
}
46+
47+
location ~* ^/looprpc.SwapClient/ {
48+
# This cannot have a slash at the end!
49+
proxy_pass https://$lnd_backend;
50+
}
51+
52+
location ~* ^/poolrpc.Trader/ {
53+
# This cannot have a slash at the end!
54+
proxy_pass https://$lnd_backend;
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)