Performance: Trailing slash behavior
MEDIUM IMPACT
This affects the server response time and client navigation speed by controlling URL redirects related to trailing slashes.
from flask import Flask app = Flask(__name__) @app.route('/page/', strict_slashes=False) def page(): return 'Page with optional trailing slash' # Accessing '/page' or '/page/' serves content directly
from flask import Flask app = Flask(__name__) @app.route('/page') def page(): return 'Page without trailing slash' # Accessing '/page/' triggers a redirect
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Strict slashes enabled (redirect on mismatch) | Minimal | 0 | Low but delayed by redirect | [X] Bad |
| Strict slashes disabled (no redirect) | Minimal | 0 | Low and immediate | [OK] Good |