Once you have created redirect rules, a JSON configuration snippet will be generated. This snippet is basically an array of rules that can be parsed with json-rules-engine. The configuration will be concatened together with a prebuilt and minified worker that runs this rule engine, parsing the conditions you created. The prebuilt worker is located here.
As soon as you hit 'Preview Worker', the final script is uploaded to the workers playground where you can test your rules and conditions.
If you are happy with the results, you can copy/paste the worker into a live environment.
All rules and conditions are created locally in your browser. As soon as you hit the Preview button, you browser will concatenate the generated rules (a JSON snippet) together with a prebuilt worker. The final script will then be posted to the Cloudflare workers playground where you can test your rules.
While I use this system in production myself, I can't guarantee it doesn't contain any weird behaviour or bugs.
As with all software, be cautious when deploying anything that you dont know what does. As a disclaimer, I should note I am not liable for any damages this script may do to your setup.
- Persistence of rules, so you dont need to enter all your redirects again if you want to update them
- Built-in support for dependent conditions, such as finding the preferred browser language, mapping countries to regions etc.
- Importing rules/redirects from a previously generated JSON configuration snippet
- Importing rules/redirects from a CSV file
- Support for Workers KV, so rules/redirects can be added without manually updating the worker
- Built-in support for other common actions. Currently only redirects are supported
- Adding support for priorities
- Support for regular expressions
It will default to proxy back to your origin server. Future support may include the possibility to generate custom default responses.
Great! Write me at [email protected]