@@ -211,7 +211,8 @@ Enable it using:
211
211
212
212
``` javascript
213
213
var DSP_CLOUDFLARE = NewDnsProvider (" cloudflare" , {
214
- " manage_redirects" : true
214
+ " manage_redirects" : true ,
215
+ " transcode_log" : " transcode.log" ,
215
216
});
216
217
```
217
218
@@ -231,8 +232,7 @@ New-style redirects ("Single Redirect Rules") are a new feature of DNSControl
231
232
as of v4.12.0 and may have bugs. Please test carefully.
232
233
{% endhint %}
233
234
234
-
235
- Conversion mode:
235
+ ### Conversion mode:
236
236
237
237
DNSControl can convert from old-style redirects (Page Rules) to new-style
238
238
redirect (Single Redirects). To enable this mode, set both ` manage_redirects `
@@ -268,7 +268,7 @@ via the CloudFlare control panel or wait for Cloudflare to remove support for th
268
268
269
269
{% hint style="warning" %}
270
270
Cloudflare's announcement says that they will convert old-style redirects (Page Rules) to new-style
271
- redirect (Single Redirects) but they do not give a date for when this will happen. DNSControl
271
+ redirect (Single Redirects) but they do not give an exact date for when this will happen. DNSControl
272
272
will probably see these new redirects as foreign and delete them.
273
273
274
274
Therefore it is probably safer to do the conversion ahead of them.
@@ -279,6 +279,54 @@ than DNSControl's. However there's no way for DNSControl to manage them since t
279
279
If you have suggestions on how to handle this better please file a bug.
280
280
{% endhint %}
281
281
282
+ ### Converting to CF_SINGLE_REDIRECT permanently
283
+
284
+ DNSControl will help convert ` CF_REDIRECT ` /` CF_TEMP_REDIRECT ` statements into
285
+ ` CF_SINGLE_REDIRECT ` statements. You might choose to do this if you do not want
286
+ to rely on the automatic translation, or if you want to edit the results of the
287
+ translation.
288
+
289
+ DNSControl will generate a file of the translated statements if you specify
290
+ a filename using the ` transcode_log ` meta option.
291
+
292
+ ``` javascript
293
+ var DSP_CLOUDFLARE = NewDnsProvider (" cloudflare" , {
294
+ " manage_single_redirects" : true ,
295
+ " transcode_log" : " transcode.log" ,
296
+ });
297
+ ```
298
+
299
+ After running ` dnscontrol preview ` the contents will look something like this:
300
+
301
+ {% code title="transcode.log" %}
302
+ ``` text
303
+ D("example.com", ...
304
+ CF_SINGLE_REDIRECT("1,302,https://example.com/*,https://replacement.example.com/$1",
305
+ 302,
306
+ 'http.host eq "example.com"',
307
+ 'concat("https://replacement.example.com", http.request.uri.path)'
308
+ ),
309
+ CF_SINGLE_REDIRECT("2,302,https://img.example.com/*,https://replacement.example.com/$1",
310
+ 302,
311
+ 'http.host eq "img.example.com"',
312
+ 'concat("https://replacement.example.com", http.request.uri.path)'
313
+ ),
314
+ CF_SINGLE_REDIRECT("3,302,https://i.example.com/*,https://replacement.example.com/$1",
315
+ 302,
316
+ 'http.host eq "i.example.com"',
317
+ 'concat("https://replacement.example.com", http.request.uri.path)'
318
+ ),
319
+ D("otherdomain.com", ...
320
+ CF_SINGLE_REDIRECT("1,301,https://one.otherdomain.com/,https://www.google.com/",
321
+ 301,
322
+ 'http.host eq "one.otherdomain.com" and http.request.uri.path eq "/"',
323
+ 'concat("https://www.google.com/", "")'
324
+ ),
325
+ ```
326
+ {% endcode %}
327
+
328
+ Copying the statements to the proper place in ` dnsconfig.js ` is manual.
329
+
282
330
283
331
## Redirects
284
332
The Cloudflare provider can manage "Forwarding URL" Page Rules (redirects) for your domains. Simply use the ` CF_REDIRECT ` and ` CF_TEMP_REDIRECT ` functions to make redirects:
0 commit comments