Verified Commit 373d4918 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Add redirects for git.archlinux.org using a map

parent bbc8c959
Pipeline #9688 passed with stage
in 49 seconds
......@@ -2,6 +2,7 @@
# - domain: the domain to listen on
# - to: the redirect target as defined by the nginx return statement
# - type: HTTP status code to use (302 = temporary redirect, 301 = permanent redirect)
# - map: the mapping file
redirects:
- mailman:
domain: mailman.archlinux.org
......@@ -15,3 +16,8 @@ redirects:
domain: coc.archlinux.org
to: https://gitlab.archlinux.org/archlinux/service-agreements/-/blob/master/code-of-conduct.md
type: 302
- cgit:
domain: git.archlinux.org
to: https://gitlab.archlinux.org
type: 301
map: maps/cgit-migrated-repos.map
/pacman.git https://gitlab.archlinux.org/pacman/pacman;
/pacman-contrib.git https://gitlab.archlinux.org/pacman/pacman-contrib;
/netctl.git https://gitlab.archlinux.org/archlinux/netctl;
/mkinitcpio.git https://github.com/archlinux/mkinitcpio;
......@@ -14,3 +14,6 @@
template: src=nginx.d.conf.j2 dest="/etc/nginx/nginx.d/redirects.conf" owner=root group=root mode=644
notify: reload nginx
tags: ['nginx']
- name: copy nginx map files
copy: src=maps dest=/etc/nginx/ owner=root group=root mode=0600
{% for redirect in redirects %}
{% if redirect.map is defined %}
map $uri ${{ redirect.map | hash('md5') }} {
default "";
include {{ redirect.map }};
}
{% endif %}
server {
listen 80;
listen [::]:80;
......@@ -17,7 +24,12 @@ server {
include snippets/letsencrypt.conf;
location / {
return {{ redirect.type }} {{ redirect.to }};
{% if redirect.map is defined %}
if (${{ redirect.map | hash('md5') }} != "") {
return {{ redirect.type }} ${{ redirect.map | hash('md5') }};
}
{% endif %}
return {{ redirect.type }} {{ redirect.to }};
}
}
{% endfor %}
......@@ -288,6 +288,7 @@ locals {
status = { value = "stats.uptimerobot.com." }
svn = { value = "gemini" }
coc = { value = "redirect" }
git = { value = "redirect" }
# MTA-STS
mta-sts = { value = "mail" }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment