Skip to content

Commit

Permalink
Change canonical domain to sober.page (Closes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
MTecknology committed Jul 16, 2024
1 parent dd509f1 commit 58c9fd2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 25 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseURL: https://about.sobersupport.group/
baseURL: https://about.sober.page/
title: Sober Page

languageCode: en-us
Expand Down
10 changes: 0 additions & 10 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ Potential uses:
- Use it as your own website address (ideal with static sites)
- Use sober.page as a "short url" service

Short URL
---------

All ``sobersupport.group`` URLs are also available via ``sober.page``. This
serves as a convenient "Short URL" which should be easier for both memory and
document spacing.

Example: https://aaX.sober.page/meetings
redirects to https://aaX.sobersupport.group/meetings

Our Commitment
--------------

Expand Down
2 changes: 1 addition & 1 deletion layouts/shortcodes/dns-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</thead>
<tbody>{{ range $key := $sorted_keys }}{{ $domain := (index $domains $key) }}
<tr class="searchable-row" data-searchable="{{ lower $key }} {{ lower $domain.title }} {{ if eq $domain.type "forward" }}{{ lower $domain.target }}{{ end }} {{ lower (default "" $domain.keywords) }}">
<td><a href="https://{{ $key }}.sobersupport.group">{{ $key }}</a>
<td><a href="https://{{ $key }}.sober.page">{{ $key }}</a>
{{- if isset $domain "keywords" }}<span class="infobutton"><button title="{{ T "expand_tip" }}" class="expand-button">+</button></span>{{ end }}</td>
<td>{{ if in $key "-" }}{{ $domain.title }}{{ else }}<b>{{ $domain.title }}</b>{{ end }}</td>
<td>{{ if eq $domain.type "forward" }}<a href="{{ $domain.target }}">{{ lower $domain.target }}</a>
Expand Down
18 changes: 9 additions & 9 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ server {
}

##
# Canonical Domain: sobersupport.group
# Note: Only external redirects should be hanlded by this server block.
# Canonical Domain: sober.page
# Note: Only external redirects should be handled by this server block.
##
map $host $canonical_redirect {
default https://about.sobersupport.group/unconfigured/;
default https://about.sober.page/unconfigured/;
include canonical_redirects.map;
}
server {
Expand All @@ -24,7 +24,7 @@ server {
add_header Vary "Accept-Encoding";

# Forward to external domain
server_name *.sobersupport.group;
server_name *.sober.page;
return 302 $canonical_redirect;

# Increase cache lifetime
Expand All @@ -35,7 +35,7 @@ server {
}

##
# Alias: sober.page
# Backup/Alias: sobersupport.group
# Note: Nearly all requests to this domain will use this server block.
##
map $http_cf_visitor $cf_scheme {
Expand All @@ -52,9 +52,9 @@ server {
add_header X-Content-Type-Options nosniff;
add_header Vary "Accept-Encoding";

# Forward <fwd>.sober.page/<path> to <fwd>.sobersupport.group/<path>
server_name ~^(?<fwd>.+)\.sober\.page$;
return 301 $cf_scheme://$fwd.sobersupport.group$request_uri;
# Forward <fwd>.sobersupport.group/<path> to <fwd>.sober.page/<path>
server_name ~^(?<fwd>.+)\.sobersupport\.group$;
return 301 $cf_scheme://$fwd.sober.page$request_uri;

# Increase cache lifetime
add_header Cloudflare-CDN-Cache-Control max-age=86400;
Expand All @@ -77,7 +77,7 @@ server {

# Forward apex and www to about page
server_name sober.page www.sober.page sobersupport.group www.sobersupport.group;
return 301 https://about.sobersupport.group$request_uri;
return 301 https://about.sober.page$request_uri;

# Increase cache lifetime
add_header Cloudflare-CDN-Cache-Control max-age=86400;
Expand Down
2 changes: 1 addition & 1 deletion static/CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
about.sobersupport.group
about.sober.page
4 changes: 2 additions & 2 deletions sync/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def push_dns(source_data, zone=None):
logging.info(f'Creating record for {subdomain}')
cf.zones.dns_records.post(zone, data={
'type': record['type'].upper(),
'name': f'{subdomain}.sobersupport.group',
'name': f'{subdomain}.sober.page',
'content': record['target'],
'proxied': record.get('cache', False),
'comment': 'sync-managed',
Expand All @@ -73,7 +73,7 @@ def push_dns(source_data, zone=None):
cf.zones.dns_records.put(
zone, current_records[subdomain]['id'], data={
'type': record['type'].upper(),
'name': f'{subdomain}.sobersupport.group',
'name': f'{subdomain}.sober.page',
'content': record['target'],
'proxied': record.get('cache', False),
'comment': 'sync-managed',
Expand Down
2 changes: 1 addition & 1 deletion sync/nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def make_map(data, path='/etc/nginx/canonical_redirects.map'):
if meta['type'].lower() != 'forward':
continue
# Append line for external redirect
fh.write(f'{subdomain}.sobersupport.group\t{meta["target"]};\n')
fh.write(f'{subdomain}.sober.page\t{meta["target"]};\n')

0 comments on commit 58c9fd2

Please sign in to comment.