Loading a rule file
Rule file are a convenient way to store and share rules. The format is defined at this specific page.
You can create rule file from a plain yaml file or with Fluxzy Desktop and reuse it with Fluxzy CLI or Fluxzy .NET SDK.
AddAlterationRules
method on FluxzySetting
supports immediately a plain string containing the yaml rule.
Create a rule file named rule.yaml
with the following content (you can find available actions and filters here):
rules:
- filter:
typeKind: HostFilter
pattern: google.com
operation: endsWith
action:
# This action remove any cache directive from request and response header
typeKind: AddBasicAuthenticationAction
username: leeloo
password: multipass
Load the rule file by calling AddAlterationRules
method on FluxzySetting
with the content of the file as argument.
using System.Net;
using Fluxzy;
var ruleContent = File.ReadAllText("rule.yaml");
var fluxzyStartupSetting = FluxzySetting
.CreateDefault(IPAddress.Loopback, 44344)
.AddAlterationRules(ruleContent);
await using var proxy = new Proxy(fluxzyStartupSetting);
_ = proxy.Run();
Console.WriteLine("Press any key to exit");
Console.ReadKey();
Y