-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathCaddyfile
More file actions
100 lines (92 loc) · 3.11 KB
/
Caddyfile
File metadata and controls
100 lines (92 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# How to use this Caddyfile configuration:
# 1. Save this content to a file named 'Caddyfile' (no extension).
# 2. Place this Caddyfile in the directory where you plan to run Caddy.
# 3. Ensure Caddy is installed.
# 4. Run Caddy from the directory containing the Caddyfile: caddy start
# (or caddy run for foreground execution, useful for debugging).
# 5. Access the endpoints via http://localhost:8080/path
# Caddyfile configuration for the mocking server
:8080 { # Listen on port 8080, change if needed
# Global CORS headers
header {
Access-Control-Allow-Origin *
Access-Control-Allow-Headers *
Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE"
Access-Control-Allow-Credentials true
}
# Handle OPTIONS preflight requests
handle_path /admin/service/registration/validateDevice /admin/service/registration/validate /admin/service/registration/getStatus /admin/service/appstore/register /emby/Plugins/SecurityInfo {
@options {
method OPTIONS
}
respond @options 204 {
header Access-Control-Max-Age 1728000
}
}
# Configuration for /admin/service/registration/validateDevice
route /admin/service/registration/validateDevice {
respond 200 {
body `{
"cacheExpirationDays": 3650,
"message": "Device Valid",
"resultCode": "GOOD"
}`
header Content-Type application/json
}
}
# Configuration for /admin/service/registration/validate
route /admin/service/registration/validate {
respond 200 {
body `{
"featId": "",
"registered": true,
"expDate": "2099-01-01",
"key": ""
}`
header Content-Type application/json
}
}
# Configuration for /admin/service/registration/getStatus
route /admin/service/registration/getStatus {
respond 200 {
body `{
"deviceStatus": "",
"planType": "Lifetime",
"subscriptions": {}
}`
header Content-Type application/json
}
}
# Configuration for /admin/service/appstore/register
route /admin/service/appstore/register {
respond 200 {
body `{
"featId": "",
"registered": true,
"expDate": "2099-01-01",
"key": ""
}`
header Content-Type application/json
}
}
# Configuration for /emby/Plugins/SecurityInfo
route /emby/Plugins/SecurityInfo {
respond 200 {
body `{
"SupporterKey": "",
"IsMBSupporter": true
}`
header Content-Type application/json
}
}
# Default fallback for unmatched paths (404 Not Found)
route {
respond 404 {
body `{
"resultCode": "ERROR",
"message": "Endpoint not found for path: {http.request.uri.path}"
}`
header Content-Type application/json
}
}
}