Back to lessons

Hosting Operations

Map Apache Proxy Rules

You need to find Apache ProxyPass and ProxyPassReverse rules.

Command

grep -RInE '^[[:space:]]*(ProxyPass|ProxyPassReverse)[[:space:]]' fixtures/apache/sites-enabled

What changed

Nothing changes. The command lists Apache proxy directives.

Danger

safe

When to use it

Use when Apache returns proxy errors or forwards traffic to the wrong backend.

When not to use it

Do not assume the backend is healthy just because ProxyPass points to it.

Undo or recovery

No undo needed because this command is read-only.

Expected output

Config files and Apache proxy target rules.

demo script

Disposable terminal steps

  1. grep -RInE '^[[:space:]]*(ProxyPass|ProxyPassReverse)[[:space:]]' fixtures/apache/sites-enabled
  2. grep -RInE 'ProxyPreserveHost|ServerName' fixtures/apache/sites-enabled

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ grep -RInE '^[[:space:]]*(ProxyPass|ProxyPassReverse)[[:space:]]' fixtures/apache/sites-enabled
fixtures/apache/sites-enabled/app.conf:5:    ProxyPass / http://127.0.0.1:7000/
fixtures/apache/sites-enabled/app.conf:6:    ProxyPassReverse / http://127.0.0.1:7000/
::exit-code::0
$ grep -RInE 'ProxyPreserveHost|ServerName' fixtures/apache/sites-enabled
fixtures/apache/sites-enabled/app.conf:2:    ServerName app.example.com
fixtures/apache/sites-enabled/app.conf:4:    ProxyPreserveHost On
fixtures/apache/sites-enabled/example.conf:2:    ServerName legacy.example.com
::exit-code::0

YouTube Short

Where is Apache proxying?

A proxy error can be a target problem. List ProxyPass rules before restarting Apache or the app.

LinkedIn hook

Apache was up. The reverse proxy target was wrong.

Question: For Apache proxy errors, do you check ProxyPass before the app logs?

experiments

A/B tests to run

Metric: watch_time

A: Wrong proxy target.

B: Map ProxyPass before restart.