-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathnginx.conf
More file actions
89 lines (80 loc) · 3.03 KB
/
nginx.conf
File metadata and controls
89 lines (80 loc) · 3.03 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
# How to use this Nginx configuration:
# 1. Save this content to a file, e.g., 'mock_server.conf'.
# 2. Place this file in your Nginx 'conf.d' directory (e.g., /etc/nginx/conf.d/)
# or include it in your main nginx.conf.
# 3. Replace 'your_domain.com' with your actual domain or server IP address.
# 4. Ensure Nginx is installed and running.
# 5. Test the Nginx configuration: sudo nginx -t
# 6. Reload Nginx to apply changes: sudo systemctl reload nginx (or service nginx reload)
# 7. Access the endpoints via http://your_domain.com:8080/path or http://localhost:8080/path
# Nginx configuration for the mocking server
server {
listen 8080; # Listen on port 8080, change if needed
server_name your_domain.com localhost; # Replace with your domain or IP
# Common CORS headers
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
# Handle OPTIONS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000; # Cache preflight for 20 days
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204; # No content for preflight
}
# Configuration for /admin/service/registration/validateDevice
location = /admin/service/registration/validateDevice {
default_type application/json;
return 200 '{
"cacheExpirationDays": 3650,
"message": "Device Valid",
"resultCode": "GOOD"
}';
}
# Configuration for /admin/service/registration/validate
location = /admin/service/registration/validate {
default_type application/json;
return 200 '{
"featId": "",
"registered": true,
"expDate": "2099-01-01",
"key": ""
}';
}
# Configuration for /admin/service/registration/getStatus
location = /admin/service/registration/getStatus {
default_type application/json;
return 200 '{
"deviceStatus": "",
"planType": "Lifetime",
"subscriptions": {}
}';
}
# Configuration for /admin/service/appstore/register
location = /admin/service/appstore/register {
default_type application/json;
return 200 '{
"featId": "",
"registered": true,
"expDate": "2099-01-01",
"key": ""
}';
}
# Configuration for /emby/Plugins/SecurityInfo
location = /emby/Plugins/SecurityInfo {
default_type application/json;
return 200 '{
"SupporterKey": "",
"IsMBSupporter": true
}';
}
# Default fallback for unmatched paths (404 Not Found)
location / {
default_type application/json;
return 404 '{
"resultCode": "ERROR",
"message": "Endpoint not found for path: $uri"
}';
}
}