Skip to content

Commit e33eb49

Browse files
Byronnshcrclaude
committed
Add workaround for http CSP configuration for WebKit browsers.
WebKit's security mechanisms block HTTP requests from applications, preventing GitButler from connecting to self-hosted instances over plain HTTP even with correct CSP configuration. Document using Caddy as a local HTTPS reverse proxy as a workaround. Based on: gitbutlerapp/gitbutler#12242 (comment) Co-authored-by: nshcr <104677079+nshcr@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5741b02 commit e33eb49

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

content/docs/troubleshooting/custom-csp.mdx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,44 @@ Note that if `extraCsp` is the only entry in the JSON file, you may want to encl
6262
}
6363
```
6464

65-
The changes will take effect the next time you start GitButler.
65+
The changes will take effect the next time you start GitButler.
66+
67+
## HTTP Instances on macOS
68+
69+
On macOS, WebKit's security mechanisms block insecure (HTTP) network requests initiated from applications. This means that even with the correct CSP configuration, GitButler will not be able to connect to self-hosted instances served over plain HTTP. Other platforms may exhibit similar behavior depending on their WebView implementation.
70+
71+
A practical workaround is to run a local HTTPS reverse proxy using [Caddy](https://caddyserver.com). Caddy automatically generates a locally-trusted TLS certificate, so GitButler sees a secure connection while your self-hosted instance continues to run over HTTP.
72+
73+
### Setting Up a Local HTTPS Proxy with Caddy
74+
75+
The following example shows how to set this up on macOS using [Homebrew](https://brew.sh), but the same approach works on any platform where Caddy is available.
76+
77+
1. Install Caddy:
78+
79+
```sh
80+
brew install caddy
81+
```
82+
83+
2. Create a `Caddyfile` (for example in `~/.config/caddy/Caddyfile`) with the following content:
84+
85+
```caddyfile
86+
https://127.0.0.1:PORT {
87+
tls internal
88+
89+
reverse_proxy http://YOUR_INSTANCE:PORT {
90+
header_up Host YOUR_INSTANCE_HOSTNAME
91+
}
92+
}
93+
```
94+
95+
Replace `YOUR_INSTANCE` and `PORT` with the hostname and port of your self-hosted instance. The `header_up Host` directive ensures the original `Host` header is forwarded correctly.
96+
97+
3. Start Caddy:
98+
99+
```sh
100+
caddy run --config ~/.config/caddy/Caddyfile
101+
```
102+
103+
4. In GitButler, set your forge URL to `https://127.0.0.1:PORT` (matching the port from your Caddyfile) instead of the original HTTP URL.
104+
105+
Your self-hosted instance will now be accessible to GitButler through the local HTTPS proxy.

0 commit comments

Comments
 (0)