Document lighttpd configuration example from matrix.jaxlug.ngo#19875
Document lighttpd configuration example from matrix.jaxlug.ngo#19875wltjr wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a documented reverse-proxy configuration example for lighttpd to Synapse’s reverse-proxy documentation, expanding the set of supported/illustrated proxy options.
Changes:
- Adds lighttpd to the list of recommended reverse proxies.
- Introduces a new “### lighttpd” section with an example configuration, including UNIX-socket proxying and
.well-knownhandling.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $HTTP["url"] =~ "/.well-known/matrix/client" { | ||
| setenv.add-response-header = ("Access-Control-Allow-Origin" => "*") | ||
| mimetype.assign = ("" => "application/json") | ||
| url.rewrite = ( | ||
| "^/.well-known/matrix/client" => "/.well-known/matrix/client.json" | ||
| ) | ||
| } |
| $HTTP["url"] =~ "/.well-known/matrix/server" { | ||
| setenv.add-response-header = ("Access-Control-Allow-Origin" => "*") | ||
| mimetype.assign = ("" => "application/json") | ||
| url.rewrite = ( | ||
| "^/.well-known/matrix/server" => "/.well-known/matrix/server.json" | ||
| ) | ||
| } |
anoadragon453
left a comment
There was a problem hiding this comment.
Please advise on the changelog aspect, I am unsure that is necessary for a documentation addition
Yes, we request a changelog entry for all changes. This is so sysadmins updating to the new version of Synapse are aware that documentation for lighttpd is now available! 😁
same with code style, and any other modifications necessary for acceptance/merge.
In general yes, though in practice the linting won't fail documentation PRs unless you update the configuration documentation, which generates a jsonschema document off the back of the markdown.
Otherwise this looks good! Thanks for taking the time to contribute upstream! ✨
| [Caddy](https://caddyserver.com/docs/quick-starts/reverse-proxy), | ||
| [HAProxy](https://www.haproxy.org/) or | ||
| [relayd](https://man.openbsd.org/relayd.8) in front of Synapse. | ||
| [HAProxy](https://www.haproxy.org/) |
There was a problem hiding this comment.
| [HAProxy](https://www.haproxy.org/) | |
| [HAProxy](https://www.haproxy.org/), |
| # serve json files as urls. is there a better way? | ||
| $HTTP["url"] =~ "/.well-known/matrix/client" { | ||
| setenv.add-response-header = ("Access-Control-Allow-Origin" => "*") | ||
| mimetype.assign = ("" => "application/json") | ||
| url.rewrite = ( | ||
| "^/.well-known/matrix/client" => "/.well-known/matrix/client.json" | ||
| ) | ||
| } | ||
| $HTTP["url"] =~ "/.well-known/matrix/server" { | ||
| setenv.add-response-header = ("Access-Control-Allow-Origin" => "*") | ||
| mimetype.assign = ("" => "application/json") | ||
| url.rewrite = ( | ||
| "^/.well-known/matrix/server" => "/.well-known/matrix/server.json" | ||
| ) | ||
| } |
There was a problem hiding this comment.
I think it would make sense to separate this out (as it's not required) into a "Delegation example" section, similar to how it's been done in the nginx, HAProxy and other HTTP server configs.
| ) | ||
| } | ||
|
|
||
| # serve json files as urls. is there a better way? |
There was a problem hiding this comment.
This looks fine (as someone who is only skimming the lighttpd docs).
I would just pop a ^ on the beginning and $ on the end of the path regexes, so you don't rewrite /.well-known/matrix/client/... requests. (edit: looks like copilot's suggestion above does this already.)
You could also avoid duplication on the headers with:
url.rewrite-once = (
"^/\.well-known/matrix/client$" =>
"/.well-known/matrix/client.json",
"^/\.well-known/matrix/server$" =>
"/.well-known/matrix/server.json"
)
# This condition intentionally matches the post-rewrite URLs.
$HTTP["url"] =~ "^/\.well-known/matrix/(client|server)\.json$" {
mimetype.assign = (
".json" => "application/json"
)
setenv.set-response-header = (
"Access-Control-Allow-Origin" => "*"
)
}
| server.username = "lighttpd" | ||
| server.groupname = "lighttpd" | ||
|
|
||
| #server.use-ipv6 = "enable" |
There was a problem hiding this comment.
If this is intended as "you can use IPv6 if you want!" comment, could you add a line saying so? Otherwise it comes across as dead code/accidentally left in.
There was a problem hiding this comment.
I added comment, you want to ensure that is commented out.
a4815c7 to
7941884
Compare
|
Changelog added, just duplicated text from commit message, I can reword or modify as necessary. Other changes made as requested. # serve json files as urls. is there a better way?I removed this line but we may want to include something. I am unsure if there is a way for lighttpd to serve up the json data without having to do a URL file redirect, my gut says there maybe, but maybe not; like how nginx handles that. In lieu of such, my crude URL rewrite to json file works and maybe that is better for people who want stand alone files and not have it in some server config. Let me know if there is anything else, thank you! |
9e3fe03 to
853fffe
Compare
A contribution from the Jacksonville Linux Users Group Inc. in setting up our Synapse Matrix protocol server matrix.jaxlug.ngo. While we mainly run Apache, we had lighttpd on some VMs for letsencrypt purposes. Since there was no documentation for lighttpd, we undertook the challenge. We had to simulate the client/server URL end points in rewriting to a json file, rather than a nifty way such as ngnix, although that might be possible in lighttpd, vs our brute force crude url rewrite method. Otherwise, this is a IPv4 and IPv6 solution running HTTP and HTTPS on both with ultra fast socket backend communication between Synapse and lighttpd. That does require each lighttpd and synapse to be members of each others group or at least one, as they both need full read/write to the socket file. This is just one of many contributions from the Jacksonville Linux Users Group, Inc. aka, the JaxLUG. Cheers!
853fffe to
481132e
Compare
|
I went ahead and added in changes for the |
A contribution from the Jacksonville Linux Users Group Inc. in setting up our Synapse Matrix protocol server matrix.jaxlug.ngo. While we mainly run Apache, we had lighttpd on some VMs for letsencrypt purposes. Since there was no documentation for lighttpd, we undertook the challenge.
We had to simulate the client/server URL end points in rewriting to a json file, rather than a nifty way such as ngnix, although that might be possible in lighttpd, vs our brute force crude url rewrite method.
Otherwise, this is a IPv4 and IPv6 solution running HTTP and HTTPS on both with ultra fast socket backend communication between Synapse and lighttpd. That does require each lighttpd and synapse to be members of each others group or at least one, as they both need full read/write to the socket file.
This is just one of many contributions from the Jacksonville Linux Users Group, Inc. aka, the JaxLUG. Cheers!
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.Please advise on the changelog aspect, I am unsure that is necessary for a documentation addition, same with code style, and any other modifications necessary for acceptance/merge.
Thank you!