Can I show a blocking page based on the visitor's language?
Short answer
Yes. The language is selected according to the preference in the Accept-Language header that the browser sends: a language condition and the page of that language are added to the Conditional Blocking Pages list in the Blocking Page window; a client that matches no condition sees the default page in the Blocking Page Source field. For Turkish and English, the English page, Turkish for visitors who prefer it template under Ready-made Templates sets this up with a single click: the default page is WAF Blocking Page (English), and the visitor who matches the If the client prefers Turkish over English condition gets WAF Blocking Page (Turkish). For other languages, the page of that language is prepared in Content Pages and a Client Language Preference condition is created. Clients that do not send Accept-Language (most API clients and bots) get the default page. At most five conditional pages are defined.
Problem: The Blocking Page Is in a Single Language
The blocking page needs to be shown to visitors in different languages in their own language; the only information that determines the language is the language preference that the browser sends.
Solution: Three Methods
| Your situation | Suitable method |
|---|---|
| Turkish and English pages are enough | Method 1: Bilingual ready-made template |
| Other languages or my own pages | Method 2: Language-conditional page |
| I will add the conditional page with a script or the command line | Method 3: WEB-CLI |
Method 1: Bilingual Ready-Made Template Recommended
- How it works The template sets up the default English page and the Turkish conditional page shown to the visitor who prefers Turkish together.
- Where it is opened Left Monitor Panel → WAF-Protected vServices → vService → WAF Management → Blocking Page card → pencil icon → Ready-made Templates
- Requirement WAF-enabled HTTP vService
- Scope A single Turkish conditional page is written in place of the existing conditional pages
Step-by-Step Configuration
In the Left Monitor Panel → WAF-Protected vServices → vService → WAF Management tab, the pencil icon at the top right of the Blocking page card in the Inspection & Blocking section is clicked.
The English page, Turkish for visitors who prefer it template under Ready-made Templates is clicked.
The Apply "English page, Turkish for visitors who prefer it"? confirmation is accepted. If the form has conditional pages, This replaces the current blocking page settings, including the N conditional page(s) below. is written below the confirmation and the number of entries to be deleted is seen. After the confirmation, the form is filled in; the existing conditional pages are removed from the list and a single Turkish conditional page comes in their place.
Edit is clicked; the change is applied without a separate deployment step. In a cluster setup, it is also sent to the peer device with the default auto-sync; if Manual Sync Mode is on, it is sent to the peer device manually.
Verification
The conditional page row on the Blocking page card on the WAF Management tab is examined; the conditional rows are placed above the default sentence in the order of evaluation.
If the client prefers Turkish over English → the WAF blocking page (Turkish) page is shown (418)A request that triggers a signature is sent with the Turkish language preference to the host group in Blocking mode; then it is repeated with the header set to en-US.
Command: curl -s -H "Accept-Language: tr-TR,tr;q=0.9,en;q=0.5" "https://www.example.com/?q=%3Cscript%3Ealert(1)%3C/script%3E"
With the Turkish preference, the content of the WAF blocking page (Turkish) profile; with en-US, Your Access To This Page Has Been Blocked!Method 2: Language-Conditional Page
- How it works A page profile and a language condition are paired for each language; the entries are tried in order, and the first matching page is shown.
- Where it is opened Content Pages · Conditions · Blocking Page card → pencil icon → Conditional Blocking Pages
- Requirement One Content Pages profile and one Client Language Preference condition per language (adding on the Content Pages and Conditions screens requires modify permission in the Load Balancer area)
- Limit At most five conditional pages
Step-by-Step Configuration
If there is no page for that language, Add is clicked on the Load Balancer → Profiles → Content Pages screen (how to add).
The content is copied into the form by clicking the WAF Blocking Page (English) template at the top of the form; a name is given and the text is translated into that language.
Add is clicked; the page is added to the profile list.
On the Load Balancer → Conditions screen, Add is clicked (how to add).
Criteria = Client Language Preference is selected. In the Language field, the language of the page (e.g. German) is selected, and in the Languages to Compare field, the languages of the other pages (e.g. English, Turkish). The condition matches when the visitor prefers this language more than the compared languages; in every language condition, Language and Languages to compare together must form the same language set, otherwise the conditions can match at the same time.
Add is clicked; the condition is added to the list. For Turkish and English, the built-in If the client prefers Turkish over English and If the client prefers English over Turkish conditions are available; these compare only these two languages.
Left Monitor Panel → WAF-Protected vServices → vService → WAF Management → the pencil icon at the top right of the Blocking Page card is clicked.
Under Conditional Blocking Pages, Add Conditional Page is clicked; a new entry titled CONDITIONAL PAGE #n opens.
In the Condition field of the entry (it shows Select conditions while empty), the condition from step 6 is selected.
In the Page Profile field, the page of that language is selected; in a new entry, WAF Blocking Page (English) comes selected.
If the Status Code field is left as Use Default Status Code, the entry uses the Blocking Status Code value; if a different code per language is not needed, it is not changed.
Blocking Page Source and the selected page are verified as the page that the visitor who matches no language condition will see.
Edit is clicked; the change is applied without a separate deployment step. In a cluster setup, it is also sent to the peer device with the default auto-sync; if Manual Sync Mode is on, it is sent to the peer device manually.
Verification
The row of each language condition on the Blocking page card is examined.
<condition> → the <page> page is shown (<code>)A request that triggers a signature is sent with the relevant language preference.
Command: curl -s -H "Accept-Language: de-DE,de;q=0.9" "https://www.example.com/?q=%3Cscript%3Ealert(1)%3C/script%3E"
The content of the German pageMethod 3: WEB-CLI
- How it works The conditional page entry is written to the
--blockingPageRuleslist with WEB-CLI; it is given with the condition and page IDs. - Where it is opened WEB-CLI →
lb condition list·lb page list·waf options show·waf options update - Requirement WEB-CLI access; a page and a condition created with steps 1-6 of Method 2; view permission in the Load Balancer area for
lb condition list(an account with only WAF permission does not see the condition table, but sees the page list) - Limit At most five conditional pages
Step-by-Step Configuration
The ID is in the id column of the list (it starts with lbConditions-):
lb condition listlb page listThe existing conditional pages appear under blockingPageRules with their indexes; for the new entry, the first empty index is used (0 if the list is empty). Writing to an occupied index replaces that entry.
waf options show poolId <vService>In place of <condition-id> and <page-id>, the IDs from steps 1 and 2 are written; the 0 in the example is for an empty list, if the list has entries the first empty index found in step 3 is written in place of 0. The command gives no output:
waf options update poolId <vService> --syncWithDefaultFwRules false --blockingPageRules.0.cond <condition-id> --blockingPageRules.0.pageProfile <page-id>Verification
The WAF settings of the vService are displayed.
Command: waf options show poolId <vService>
The condition and the page written under blockingPageRulesCommon Mistakes
- Writing the language conditions with different language sets. For example, the Turkish condition of the template compares only Turkish and English; together with a condition written with a separate set for German, a visitor can match both conditions and the page that comes first in the list is shown. All the language conditions are written with the same language set.
- Expecting a language for clients that do not send Accept-Language. These clients match no language condition and get the default page.
- Thinking that the bilingual template keeps the existing conditional pages. The template replaces the list with a single Turkish entry; other conditional pages are added again after the template.
How it is done in the documentation
