Hi
Back when Nginx was in the front, this tutorial was very helpful Accessing my Tutor site with www - #3 by iwebhost4u
With Caddy, I am not sure how to proceed in order to redirect https://www.myopenedx.com to https://myopenedx.com
Grateful for help!
Thanks!
Hi
After some digging, I came up with a workaround. Definitely not the best way to do it, but at least it works. The proper way is to build a plugin which i have no idea how it would look like for Caddy!
OK, here is the workaround:
Open the Caddyfile in /tutor/templates/apps/caddy
add the lines
www.myopenedx.com {
redir https://myopenedx.com{uri}
}
The file should look like
{{ LMS_HOST }}{% if not ENABLE_HTTPS %}:80{% endif %} {
reverse_proxy nginx:80 {
header_up X-Forwarded-Port {{ 443 if ENABLE_HTTPS else 80 }}
}
}
preview.{{ LMS_HOST }}{% if not ENABLE_HTTPS %}:80{% endif %} {
reverse_proxy nginx:80
}
{{ CMS_HOST }}{% if not ENABLE_HTTPS %}:80{% endif %} {
reverse_proxy nginx:80
}
www.myopenedx.com {
redir https://myopenedx.com{uri}
}
{{ patch("caddyfile") }}
Run
tutor local quickstart
Cheers
1 Like
No need to open the file, you can amend the caddyfile with a custom Tutor YAML plugin, including your preferred changes by:
name: caddy-changes
version: 0.0.1
patches:
caddyfile: |
"YOUR CHANGES HERE"
The documentation also have some excellent instructions on how to deploy your plugin .
Thanks @ak00001
For the benefits of all, would the Plugin look like?
name: caddy-www-redirect
version: 0.0.1
patches:
caddyfile: |
www.myopenedx.com {
redir https://myopenedx.com{uri}
}
Does this make sens? I am not sure of the syntax!
Cheers
1 Like
regis
June 28, 2021, 5:23pm
5
Yes @nachham , the plugin would be quite similar to that!
system
Closed
September 26, 2021, 5:23pm
6
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.