-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaddyfile.dev
More file actions
127 lines (106 loc) · 2.18 KB
/
Caddyfile.dev
File metadata and controls
127 lines (106 loc) · 2.18 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
:80 {
# Enable compression
encode gzip
# Basic security headers for development
header {
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
X-XSS-Protection "1; mode=block"
Referrer-Policy "strict-origin-when-cross-origin"
-Server
}
# API routes - proxy to FastAPI backend
handle /api/* {
# Wide open CORS for development
header {
Access-Control-Allow-Origin "*"
Access-Control-Allow-Credentials "true"
Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With"
Access-Control-Max-Age "86400"
}
# Handle preflight requests
@options {
method OPTIONS
}
handle @options {
respond 204
}
# Simple proxy for dev - no need for header manipulation
reverse_proxy backend:8000
}
# Health check for backend
handle /health {
reverse_proxy backend:8000
}
# Serve static files
root * /srv/frontend
# JavaScript files with proper MIME type
handle /js/*.js {
header Content-Type "application/javascript"
header Cache-Control "public, max-age=3600"
file_server
}
# CSS files
handle /assets/css/*.css {
header Content-Type "text/css"
header Cache-Control "public, max-age=3600"
file_server
}
# Favicon
handle /favicon.ico {
rewrite * /assets/favicon.ico
file_server
}
# Cache static assets
handle /assets/* {
header Cache-Control "public, max-age=31536000"
file_server
}
# Simple page routes
handle /login {
rewrite * /login.html
file_server
}
handle /wizard {
rewrite * /wizard.html
file_server
}
handle /prices {
rewrite * /prices.html
file_server
}
handle /import {
rewrite * /import.html
file_server
}
handle /floorplan {
rewrite * /floorplan.html
file_server
}
handle /settings {
rewrite * /settings.html
file_server
}
handle /packing {
rewrite * /packing.html
file_server
}
handle /boxes {
rewrite * /boxes.html
file_server
}
handle /getting-started {
rewrite * /getting-started.html
file_server
}
# Root serves index.html (which redirects to wizard)
handle / {
rewrite * /index.html
file_server
}
# Default file server for everything else
handle {
file_server
}
}