.. _example_service_traffic-proxy_block_basic:
#####
Basic
#####
This scenario shows how to configure the traffic-proxy service
to serve html pages for blocked traffic, this section shows how
to customize block template pages.
.. image:: block-proxy.svg
:width: 800
*****************
Basic HTTPS Block
*****************
Description
===========
This example demonstrates how to configure the
``service traffic-proxy`` to block HTTPS traffic based
on a ``connmark`` match. First, a block rule is configured
without a traffic policy marking packets, so traffic
should not be blocked. Then, a traffic policy is applied
to mark flows with connmark ``1000``, which triggers
the block rule and serves the default OSDx block page.
Scenario
========
.. include:: basic/basichttpsblock
.. raw:: html
****************
Basic HTTP Block
****************
Description
===========
This example demonstrates how to configure the
``service traffic-proxy`` to block HTTP traffic based
on a ``connmark`` match. First, a block rule is configured
without a traffic policy marking packets, so traffic
should not be blocked. Then, a traffic policy is applied
to mark flows with connmark ``1000``, which triggers
the block rule and serves the default OSDx block page.
Scenario
========
.. include:: basic/basichttpblock
.. raw:: html
****************************
Customize Default Block Page
****************************
Description
===========
This example demonstrates how to replace the default
block page with a custom HTML template. The template
file ``customized_block_template.html`` is uploaded to the DUT and
configured via ``block template file``. A template
variable ``REASON`` is defined with a default value
that is rendered in the blocked response. The test
verifies that the custom page is served with the
expected content when traffic is blocked.
Scenario
========
.. include:: basic/customizedefaultblockpage
.. raw:: html
*******************************************
Customize Block Page Based On Matching rule
*******************************************
Description
===========
This example demonstrates how to override template
variables on a per-rule basis. A default ``REASON``
value is set at the template level, but the block
rule overrides it with a specific value using
``block rule 1 set variable``. The test verifies
that the rule-level value takes precedence over the
default template variable in the blocked response.
Scenario
========
.. include:: basic/customizeblockpagebasedonmatchingrule
.. raw:: html