Skip to content

Commit

Permalink
Rename vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ruffsl committed May 5, 2023
1 parent ff3298f commit 3e2d1b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .devcontainer/caddy/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
expression {http.request.scheme}=="https" || {header.X-Forwarded-Scheme}=="https"
}
# If any http scheme is "https", then use "wss"
vars @http_scheme WsScheme "wss"
vars @http_scheme ws.scheme "wss"
# Else default to "ws"
vars WsScheme "ws"
vars ws.scheme "ws"

# Matcher for forwarded request headers
@host_forwarded {
header X-Forwarded-Host *
}
# If http headers exists, then use them
vars @host_forwarded WsHost {header.X-Forwarded-Host}
vars @host_forwarded ws.host {header.X-Forwarded-Host}
# Else default to host in request
vars WsHost {http.request.hostport}
vars ws.host {http.request.hostport}
}

# Snippet for redirect with given URL queries values
# to simplify remote development with web apps
# E.g auto redirect websocket URL to match request scheme
(redirect) {
# Configure redirect to match request scheme
redir /{args.0}/nav2 /{args.0}/?ds=foxglove-websocket&ds.url={vars.WsScheme}://{vars.WsHost}{path.dir}
redir /{args.0}/nav2 /{args.0}/?ds=foxglove-websocket&ds.url={vars.ws.scheme}://{vars.ws.host}{path.dir}
}

# Listen for http requests on port 8080
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/caddy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
| `header.X-Forwarded-Scheme` | `{{placeholder "header.X-Forwarded-Scheme"}}` |
| `http.request.hostport` | `{{placeholder "http.request.hostport"}}` |
| `http.request.scheme` | `{{placeholder "http.request.scheme"}}` |
| `http.vars.WsHost` | `{{placeholder "http.vars.WsHost"}}` |
| `http.vars.WsScheme` | `{{placeholder "http.vars.WsScheme"}}` |
| `http.vars.ws.host` | `{{placeholder "http.vars.ws.host"}}` |
| `http.vars.ws.scheme` | `{{placeholder "http.vars.ws.scheme"}}` |

0 comments on commit 3e2d1b3

Please sign in to comment.