Testing caddy

This commit is contained in:
2020-05-05 15:09:14 +02:00
parent cfd9e5410f
commit eae3a9103a
8 changed files with 126 additions and 160 deletions
+51
View File
@@ -0,0 +1,51 @@
(security) {
header * {
-Server
-Date
Strict-Transport-Security "max-age=31536000; includeSubDomains"
Content-Security-Policy "default-src 'self' 'unsafe-inline' https://fonts.gstatic.com https://fonts.googleapis.com https://cdn.jsdelivr.net;"
Feature-Policy "geolocation none;midi none;notifications none;push none;sync-xhr none;microphone none;camera none;magnetometer none;gyroscope none;speaker self;vibrate none;fullscreen self;payment none;"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
X-XSS-Protection "1; mode=block"
Referrer-Policy "origin"
}
}
localhost {
@static {
path *.css *.js
file
}
@404 {
expression {http.error.status_code} == 404
}
route /* {
reverse_proxy http://localhost:3000
}
handle_errors {
rewrite @404 /404.html
reverse_proxy http://localhost:3000
}
route /api/* {
uri strip_prefix /api
reverse_proxy http://localhost:8081
}
header @static Cache-Control "public, max-age=31536000"
encode gzip
root * /home/hubert/Workspace/Notes-TFE/frontend/dist
log
import security
}
www.localhost {
redir * https://localhost{path}
}
+52
View File
@@ -0,0 +1,52 @@
(security) {
header * {
-Server
-Date
Strict-Transport-Security "max-age=31536000; includeSubDomains"
Content-Security-Policy "default-src 'self' 'unsafe-inline' https://fonts.gstatic.com https://fonts.googleapis.com https://cdn.jsdelivr.net;"
Feature-Policy "geolocation none;midi none;notifications none;push none;sync-xhr none;microphone none;camera none;magnetometer none;gyroscope none;speaker self;vibrate none;fullscreen self;payment none;"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
X-XSS-Protection "1; mode=block"
Referrer-Policy "origin"
}
}
simplenotes.be {
@static {
path *.css *.js
file
}
@404 {
expression {http.error.status_code} == 404
}
route /* {
file_server
}
handle_errors {
rewrite @404 /404.html
file_server
import security
}
route /api/* {
uri strip_prefix /api
reverse_proxy http://api:8081
}
header @static Cache-Control "public, max-age=31536000"
encode gzip
root * /site
log
import security
}
www.simplenotes.be {
redir * https://simplenotes.be{path}
}
+6
View File
@@ -0,0 +1,6 @@
FROM caddy:2.0.0
COPY caddy/Caddyfile.prod /etc/caddy/Caddyfile
# Copy main website
COPY frontend/dist /site