GoDoxy
Advanced TopicsMiddlewaresContent Modification

Modify HTML

Modify the HTML content

Configuration

OptionDescriptionDefault
targetCSS selector-
htmlHTML to inject-
replaceReplace modefalse

Behavior

Supported Selectors

It supports common CSS selectors, for example:

Selector TypeExample
elementbody
ID#main
class.container
attribute[data-test='val']

Examples

# Inject CSS into head
proxy.myapp.middlewares.modify_html: |
  target: head
  html: '<style>body { background: red; }</style>'

# Replace main content
proxy.myapp.middlewares.modify_html: |
  target: main
  html: '<section><h2>New</h2></section>'
  replace: true

On this page