|
8 | 8 | return [ |
9 | 9 | [ |
10 | 10 | 'pattern' => 'robots.txt', |
11 | | - 'action' => function () { |
| 11 | + 'method' => 'GET|HEAD', |
| 12 | + 'action' => function () { |
12 | 13 | if (Seo::option('robots.active')) { |
13 | 14 | $content = snippet('seo/robots.txt', [], true); |
14 | 15 | return new Response($content, 'text/plain', 200); |
|
17 | 18 | $this->next(); |
18 | 19 | } |
19 | 20 | ], |
| 21 | + [ |
| 22 | + 'pattern' => 'robots.txt', |
| 23 | + 'method' => 'OPTIONS', |
| 24 | + 'action' => function () { |
| 25 | + return new Response('', 'text/plain', 204, ['Allow' => 'GET, HEAD']); |
| 26 | + } |
| 27 | + ], |
| 28 | + [ |
| 29 | + 'pattern' => 'robots.txt', |
| 30 | + 'method' => 'ALL', |
| 31 | + 'action' => function () { |
| 32 | + return new Response('Method Not Allowed', 'text/plain', 405, ['Allow' => 'GET, HEAD']); |
| 33 | + } |
| 34 | + ], |
| 35 | + |
20 | 36 | [ |
21 | 37 | 'pattern' => 'sitemap', |
22 | | - 'action' => function () { |
| 38 | + 'method' => 'GET|HEAD', |
| 39 | + 'action' => function () { |
23 | 40 | if (!Seo::option('sitemap.redirect') || !Seo::option('sitemap.active')) { |
24 | 41 | $this->next(); |
25 | 42 | } |
26 | 43 |
|
27 | 44 | go('/sitemap.xml'); |
28 | 45 | } |
29 | 46 | ], |
| 47 | + [ |
| 48 | + 'pattern' => 'sitemap', |
| 49 | + 'method' => 'OPTIONS', |
| 50 | + 'action' => function () { |
| 51 | + return new Response('', 'text/plain', 204, ['Allow' => 'GET, HEAD']); |
| 52 | + } |
| 53 | + ], |
| 54 | + [ |
| 55 | + 'pattern' => 'sitemap', |
| 56 | + 'method' => 'ALL', |
| 57 | + 'action' => function () { |
| 58 | + return new Response('Method Not Allowed', 'text/plain', 405, ['Allow' => 'GET, HEAD']); |
| 59 | + } |
| 60 | + ], |
| 61 | + |
30 | 62 | [ |
31 | 63 | 'pattern' => 'sitemap.xsl', |
32 | | - 'action' => function () { |
| 64 | + 'method' => 'GET', |
| 65 | + 'action' => function () { |
33 | 66 | if (!Seo::option('sitemap.active')) { |
34 | 67 | $this->next(); |
35 | 68 | } |
|
49 | 82 | ])->render(contentType: 'xsl'); |
50 | 83 | } |
51 | 84 | ], |
| 85 | + [ |
| 86 | + 'pattern' => 'sitemap.xsl', |
| 87 | + 'method' => 'OPTIONS', |
| 88 | + 'action' => function () { |
| 89 | + return new Response('', 'text/plain', 204, ['Allow' => 'GET']); |
| 90 | + } |
| 91 | + ], |
| 92 | + [ |
| 93 | + 'pattern' => 'sitemap.xsl', |
| 94 | + 'method' => 'ALL', |
| 95 | + 'action' => function () { |
| 96 | + return new Response('Method Not Allowed', 'text/plain', 405, ['Allow' => 'GET']); |
| 97 | + } |
| 98 | + ], |
| 99 | + |
52 | 100 | [ |
53 | 101 | 'pattern' => 'sitemap.xml', |
54 | | - 'action' => function () { |
| 102 | + 'method' => 'GET|HEAD', |
| 103 | + 'action' => function () { |
55 | 104 | if (!Seo::option('sitemap.active', true)) { |
56 | 105 | $this->next(); |
57 | 106 | } |
|
69 | 118 | ])->render(contentType: 'xml'); |
70 | 119 | } |
71 | 120 | ], |
| 121 | + [ |
| 122 | + 'pattern' => 'sitemap.xml', |
| 123 | + 'method' => 'OPTIONS', |
| 124 | + 'action' => function () { |
| 125 | + return new Response('', 'text/plain', 204, ['Allow' => 'GET, HEAD']); |
| 126 | + } |
| 127 | + ], |
| 128 | + [ |
| 129 | + 'pattern' => 'sitemap.xml', |
| 130 | + 'method' => 'ALL', |
| 131 | + 'action' => function () { |
| 132 | + return new Response('Method Not Allowed', 'text/plain', 405, ['Allow' => 'GET, HEAD']); |
| 133 | + } |
| 134 | + ], |
| 135 | + |
72 | 136 | [ |
73 | 137 | 'pattern' => 'sitemap-(:any).xml', |
74 | | - 'action' => function (string $index) { |
| 138 | + 'method' => 'GET|HEAD', |
| 139 | + 'action' => function (string $index) { |
75 | 140 | if (!Seo::option('sitemap.active', true)) { |
76 | 141 | $this->next(); |
77 | 142 | } |
|
92 | 157 | ], |
93 | 158 | ])->render(contentType: 'xml'); |
94 | 159 | } |
95 | | - ] |
| 160 | + ], |
| 161 | + [ |
| 162 | + 'pattern' => 'sitemap-(:any).xml', |
| 163 | + 'method' => 'OPTIONS', |
| 164 | + 'action' => function () { |
| 165 | + return new Response('', 'text/plain', 204, ['Allow' => 'GET, HEAD']); |
| 166 | + } |
| 167 | + ], |
| 168 | + [ |
| 169 | + 'pattern' => 'sitemap-(:any).xml', |
| 170 | + 'method' => 'ALL', |
| 171 | + 'action' => function () { |
| 172 | + return new Response('Method Not Allowed', 'text/plain', 405, ['Allow' => 'GET, HEAD']); |
| 173 | + } |
| 174 | + ], |
96 | 175 | ]; |
0 commit comments