Forem Creators and Builders 🌱

Discussion on: www. or nah

Collapse
 
jumpdo profile image
jumpdo

I might be late, but it may help for future forem users,

If you don't want to use www or any subdomain in forem, While installing selfhost, remove {{ forem_subdomain_name }}. line in app_domain at inventory/forem/setup.yml

Convert this line from

app_domain: "{{ forem_subdomain_name }}.{{ forem_domain_name }}"
Enter fullscreen mode Exit fullscreen mode

to

app_domain: "{{ forem_domain_name }}"
Enter fullscreen mode Exit fullscreen mode

then it will work.

If you have already installed forem and you want to redirect non www to www or vice versa, then add non www domain at /opt/forem/configs/traefik/dynamic.toml

rule = "(Host(`domain.com`) || Host(`www.domain.com`)) && Method(`GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`)"
Enter fullscreen mode Exit fullscreen mode

and redirect non www to www at /opt/forem/configs/nginx.conf

server {
     if ($host = domain.com) {
        return 301 https://www.domain.com$request_uri;
     }
}
Enter fullscreen mode Exit fullscreen mode

After that it will works fine. i tried it and its works for me