Skip to content

Commit 209682d

Browse files
authored
fix: use location instead of rewrite directive to avoid rewrite loop (#15)
1 parent 3d3e615 commit 209682d

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

docker/default.conf

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,32 @@ server {
44

55
root /htdocs;
66

7+
# Serve index.html
8+
location = / {
9+
try_files /index.html =404;
10+
}
11+
712
# Exact generated redirects
813
include includes/jira-to-github-redirects.conf;
914

1015
# Generic fallback rewrites
11-
rewrite ^/issue/([0-9]+)$ https://issues.jenkins.io/browse/JENKINS-$1 permanent;
12-
rewrite ^/issue/([A-Z]+-[0-9]+)$ https://issues.jenkins.io/browse/$1 permanent;
13-
rewrite ^/([A-Z]+-[0-9]+)$ https://issues.jenkins.io/browse/$1 permanent;
14-
rewrite ^/browse/([A-Z]+-[0-9]+)$ https://issues.jenkins.io/browse/$1 permanent;
16+
# /issue/12345
17+
location ~ ^/issue/([0-9]+)$ {
18+
return 301 https://issues.jenkins.io/browse/JENKINS-$1;
19+
}
20+
21+
# /issue/JENKINS-12345 or /issue/INFRA-123
22+
location ~ ^/issue/([A-Z]+-[0-9]+)$ {
23+
return 301 https://issues.jenkins.io/browse/$1;
24+
}
25+
26+
# /JENKINS-12345 or /INFRA-123
27+
location ~ ^/([A-Z]+-[0-9]+)$ {
28+
return 301 https://issues.jenkins.io/browse/$1;
29+
}
1530

16-
return 404;
31+
# /browse/JENKINS-12345 or /browse/INFRA-123
32+
location ~ ^/browse/([A-Z]+-[0-9]+)$ {
33+
return 301 https://issues.jenkins.io/browse/$1;
34+
}
1735
}

0 commit comments

Comments
 (0)