Using Transform Rules for Traffic Routing

Attempting to add City/Metro data to CF Headers so we can use this to Filter Traffic/Route Website traffic. 1. Transform Rules: Enabled Location Headers.
2. Security > WAF: Created Rule to filter cf-metro-code and cf-ipcity, but not sure if this setup is correct.
Please review, thank you.

Hi,

Since the each of the location headers match one dynamic field, you should rather create WAF rules based on the fields themselves. Adding a location headers makes sense if they are to be processed by the origin server.

You can check the fields that each header represents and use them in the WAF Expression Editor:

Thank you, @cbrandt . I will do that, but first: Is it Correct to use cf-metro-code for the Name, or ip.src.metro_code ?

Example: (any(http.request.headers["cf-metro-code"][*] eq "528"))

Thanks again!

If you’re on paid plan and you’re using WAF and select Header as the field in the Expression Builder, that’s exactly the expression it creates when you add the header name as cf-metro-code. So this must be right.

All header names should be used in lowercase, so this should work.

You would only use the field name instead of the header name in the Expression Editor:

(ip.src.metro_code eq "438")

1 Like

Worked like a charm!! Thank you so much @cbrandt :beers: :sunglasses:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.