Skip to content

Commit 4da15d9

Browse files
committed
feat: enable httpgate
1 parent 34824d0 commit 4da15d9

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

internal/edged/caddy/main.go

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,30 @@ func Update(database *gorm.DB, caddyFilePath, nodeId, certDir string) error {
132132
tlsDirective = "tls " + path.Join(certDir, domain+".cert") + " " + path.Join(certDir, domain+".key")
133133
}
134134

135+
var httpgateDirective string
136+
if domain != "httpgate-broker.packetframe.com" {
137+
httpgateDirective = "packetframe_httpgate https://httpgate-broker.packetframe.com always"
138+
}
139+
135140
caddyFile += domain + ` {
136141
` + tlsDirective + `
137-
reverse_proxy /.well-known/acme-challenge/* {
138-
to http://172.16.90.1:8081
142+
route /.well-known/acme-challenge/* {
143+
reverse_proxy http://172.16.90.1:8081
139144
}
140-
reverse_proxy {
141-
to ` + strings.Join(ips, " ") + `
142-
lb_policy round_robin
143-
header_up X-Packetframe-PoP "` + nodeId + `"
144-
header_up Host ` + domain + `
145-
transport http {
146-
tls
147-
tls_insecure_skip_verify
148-
tls_server_name ` + domain + `
149-
dial_timeout 5s
150-
response_header_timeout 30s
145+
route {
146+
` + httpgateDirective + `
147+
reverse_proxy {
148+
to ` + strings.Join(ips, " ") + `
149+
lb_policy round_robin
150+
header_up X-Packetframe-PoP "` + nodeId + `"
151+
header_up Host ` + domain + `
152+
transport http {
153+
tls
154+
tls_insecure_skip_verify
155+
tls_server_name ` + domain + `
156+
dial_timeout 5s
157+
response_header_timeout 30s
158+
}
151159
}
152160
}
153161
}

0 commit comments

Comments
 (0)