-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f359fc1
commit c0416c6
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
### Example Caddyfile for Inventree | ||
# The following environment variables may be used: | ||
# - INVENTREE_SITE_URL: The upstream URL of the Inventree site (default: inventree.localhost) | ||
# - INVENTREE_SERVER: The internal URL of the Inventree container (default: http://inventree-server:8000) | ||
# | ||
# Note that while this file is a good starting point, it may need to be modified to suit your specific requirements | ||
|
||
|
||
(log_common) { | ||
log { | ||
output file /var/log/caddy/{args[0]}.access.log | ||
} | ||
} | ||
|
||
(cors-headers) { | ||
header Allow GET,HEAD,OPTIONS | ||
header Access-Control-Allow-Origin * | ||
header Access-Control-Allow-Methods GET,HEAD,OPTIONS | ||
header Access-Control-Allow-Headers Authorization,Content-Type,User-Agent | ||
|
||
@cors_preflight{args[0]} method OPTIONS | ||
|
||
handle @cors_preflight{args[0]} { | ||
respond "" 204 | ||
} | ||
} | ||
|
||
# Change the host to your domain (this will serve at inventree.localhost) | ||
{$INVENTREE_SITE_URL:inventree.localhost} { | ||
import log_common inventree | ||
|
||
encode gzip | ||
|
||
request_body { | ||
max_size 100MB | ||
} | ||
|
||
handle_path /static/* { | ||
import cors-headers static | ||
|
||
root * /var/www/static | ||
file_server | ||
} | ||
|
||
handle_path /media/* { | ||
import cors-headers media | ||
|
||
root * /var/www/media | ||
file_server | ||
|
||
header Content-Disposition attachment | ||
|
||
forward_auth {$INVENTREE_SERVER:"http://inventree-server:8000"} { | ||
uri /auth/ | ||
} | ||
} | ||
|
||
reverse_proxy {$INVENTREE_SERVER:"http://inventree-server:8000"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Custom Caddyserver image for InvenTree | ||
# Adds a custom configuration file to the Caddyserver image, | ||
# designed to work "out of the box" with InvenTree. | ||
|
||
FROM caddy:alpine AS inventree_caddy | ||
|
||
# Copy the custom Caddyfile into the image | ||
COPY Caddyfile /etc/caddy/Caddyfile |