Modify HTML
Modify the HTML content
Configuration
| Option | Description | Default |
|---|---|---|
target | CSS selector | - |
html | HTML to inject | - |
replace | Replace mode | false |
Behavior
Supported Selectors
It supports common CSS selectors, for example:
| Selector Type | Example |
|---|---|
| element | body |
| 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