Configuration for Caddy Reverse Proxy (without Nginx) #313

Open
opened 2022-10-17 04:13:49 +00:00 by adamshand · 3 comments
adamshand commented 2022-10-17 04:13:49 +00:00 (Migrated from gitlab.com)

Hello,

I've just been setting up Conduit for my homeserver, very nice thanks!

I've included the configuration that I am using with Caddy that seems to work and does not require Nginx to serve the .well-known locations. I hope it's useful for the documentation.

example.nz {
  header /.well-known/matrix/* Content-Type application/json
  header /.well-known/matrix/* Access-Control-Allow-Origin *
  respond /.well-known/matrix/server `{"m.server": "chat.example.nz:443"}`
  respond /.well-known/matrix/client `{"m.homeserver": {"base_url": "https://chat.example.nz"}}`
}

chat.example.nz {
  reverse_proxy /_matrix/* conduit:6167
  reverse_proxy /_synapse/client/* conduit:6167
}

I believe that this could also be combined into a single stanza if you were happy to have user accounts like @adam:chat.example.nz instead of @adam:example.nz.

chat.example.nz {
  header /.well-known/matrix/* Content-Type application/json
  header /.well-known/matrix/* Access-Control-Allow-Origin *
  respond /.well-known/matrix/server `{"m.server": "chat.example.nz:443"}`
  respond /.well-known/matrix/client `{"m.homeserver": {"base_url": "https://chat.example.nz"}}`
  reverse_proxy /_matrix/* conduit:6167
  reverse_proxy /_synapse/client/* conduit:6167
}

Many thanks,
Adam.

Hello, I've just been setting up Conduit for my homeserver, very nice thanks! I've included the configuration that I am using with Caddy that seems to work and does not require Nginx to serve the `.well-known` locations. I hope it's useful for the documentation. ``` example.nz { header /.well-known/matrix/* Content-Type application/json header /.well-known/matrix/* Access-Control-Allow-Origin * respond /.well-known/matrix/server `{"m.server": "chat.example.nz:443"}` respond /.well-known/matrix/client `{"m.homeserver": {"base_url": "https://chat.example.nz"}}` } chat.example.nz { reverse_proxy /_matrix/* conduit:6167 reverse_proxy /_synapse/client/* conduit:6167 } ``` I believe that this could also be combined into a single stanza if you were happy to have user accounts like `@adam:chat.example.nz` instead of `@adam:example.nz`. ``` chat.example.nz { header /.well-known/matrix/* Content-Type application/json header /.well-known/matrix/* Access-Control-Allow-Origin * respond /.well-known/matrix/server `{"m.server": "chat.example.nz:443"}` respond /.well-known/matrix/client `{"m.homeserver": {"base_url": "https://chat.example.nz"}}` reverse_proxy /_matrix/* conduit:6167 reverse_proxy /_synapse/client/* conduit:6167 } ``` Many thanks, Adam.
adamshand commented 2022-10-17 04:15:02 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
adamshand commented 2022-10-17 04:15:38 +00:00 (Migrated from gitlab.com)

changed title from Configuration for Caddy Reverse Proxy to Configuration for Caddy Reverse Proxy{+ (without Nginx)+}

changed title from **Configuration for Caddy Reverse Proxy** to **Configuration for Caddy Reverse Proxy{+ (without Nginx)+}**
ja0nz commented 2022-10-26 11:27:36 +00:00 (Migrated from gitlab.com)

Just my 2 cents:

  1. Caddy can infer the JSON Content type by itself - if it's valid JSON https://caddyserver.com/docs/caddyfile/directives/respond
  2. You may use the host placeholder instead of repeating the address
chat.example.nz {
  reverse_proxy element
  reverse_proxy /_matrix/* conduit:6167
  respond /.well-known/matrix/server `{"m.server": "{host}:443"}`
  respond /.well-known/matrix/client `{"m.homeserver": {"base_url": "https://{host}"}}`
}
Just my 2 cents: 1. Caddy can infer the JSON Content type by itself - if it's valid JSON https://caddyserver.com/docs/caddyfile/directives/respond 2. You may use the **host placeholder** instead of repeating the address ``` chat.example.nz { reverse_proxy element reverse_proxy /_matrix/* conduit:6167 respond /.well-known/matrix/server `{"m.server": "{host}:443"}` respond /.well-known/matrix/client `{"m.homeserver": {"base_url": "https://{host}"}}` } ```
Sign in to join this conversation.
No labels
Android
CS::needs customer feedback
CS::needs follow up
CS::needs on prem installation
CS::waiting
Chrome
Design:: Ready
Design:: in progress
Design::UX
E2EE
Edge
Firefox
GDPR
Iteration 13 IM
Linux
MacOS
Need::Discussion
Need::Steps to reproduce
Need::Upstream fix
Needs:: Planning
Needs::Dev-Team
Needs::More information
Needs::Priority
Needs::Product
Needs::Refinement
Needs::Severity
Priority::1-Critical
Priority::2-Max
Priority::3-Impending
Priority::4-High
Priority::5-Medium
Priority::6-Low
Priority::7-None
Progress::Backlog
Progress::Review
Progress::Started
Progress::Testing
Progress::Triage
Progress::Waiting
Reporter::Sentry
Safari
Target::Community
Target::Customer
Target::Internal
Target::PoC
Target::Security
Team:Customer-Success
Team:Design
Team:Infrastructure
Team:Instant-Messaging
Team:Product
Team:Workflows
Type::Bug
Type::Design
Type::Documentation
Type::Feature
Type::Improvement
Type::Support
Type::Tests
Windows
blocked
blocked-by-spec
cla-signed
conduit
contribution::advanced
contribution::easy
contribution::help needed
from::review
iOS
p::ti-tenant
performance
product::triage
proposal
refactor
release-blocker
s: dart_openapi_codegen
s::Famedly-Patient
s::Org-Directory
s::Passport-Generator
s::Requeuest
s:CRM
s:Famedly-App
s:Famedly-Web
s:Fhiroxide
s:Fhiroxide-cli
s:Fhiroxide-client
s:Fhirs
s:Hedwig
s:LISA
s:Matrix-Dart-SDK
s:Role-Manager
s:Synapse
s:User-Directory
s:WFS-Matrix
s:Workflow Engine
s:dtls
s:famedly-error
s:fcm-shared-isolate
s:matrix-api-lite
s:multiple-tab-detector
s:native-imaging
severity::1
severity::2
severity::3
severity::4
technical-debt
voip
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Matthias/conduit#313
No description provided.