forked from overhangio/tutor-mfe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaddyfile
More file actions
71 lines (64 loc) · 2.15 KB
/
Copy pathCaddyfile
File metadata and controls
71 lines (64 loc) · 2.15 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
:8002 {
log {
output stdout
format filter {
wrap json
fields {
common_log delete
request>headers delete
resp_headers delete
tls delete
}
}
}
{{ patch("mfe-caddyfile") | indent(4) }}
reverse_proxy /api/mfe_config/v1* lms:8000 {
# We need to specify the host header, otherwise it will be rejected with 400
# from the lms.
header_up Host {{ LMS_HOST }}
}
{% if is_mfe_enabled("authoring") %}
# redirect /course-authoring to /authoring, for backward compatibility
@authoring path_regexp authoring /course-authoring/(.*)
redir @authoring /authoring/{re.authoring.1} permanent
{% endif %}
{% for app_name, app in iter_paths() %}
{%- if is_frontend_app(app_name) %}
@app_{{ app_name }} {
path /{{ app_name }} /{{ app_name }}/*
}
handle @app_{{ app_name }} {
uri strip_prefix /{{ app_name }}
root * /openedx/dist/site-{{ app.get("site", "default") }}
try_files /{path} /index.html
file_server
}
{%- else %}
@mfe_{{ app_name }} {
path /{{ app_name }} /{{ app_name }}/*
}
handle @mfe_{{ app_name }} {
uri strip_prefix /{{ app_name }}
root * /openedx/dist/{{ app_name }}
try_files /{path} /index.html
file_server
}
{%- endif %}
{% endfor %}
# Handle frontend sites, which are meant to serve only static assets, without an index.html.
# When fetched from the proper url handle they'll be returned with a index.html,
# but if someone tries to access them directly (like the chunk links or general assets)
# they'll get the files directy from this block
{% for site_name, app in iter_frontend_sites() %}
@site_{{ site_name }} {
path /site-{{ site_name }} /site-{{ site_name }}/*
}
handle @site_{{ site_name }} {
uri strip_prefix /site-{{ site_name }}
root * /openedx/dist/site-{{ site_name }}
# no index.html because we want to focus on assets in these ones
try_files /{path}
file_server
}
{% endfor %}
}