Skip to content

Commit

Permalink
Reorder middleware so header changes are picked up in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed May 14, 2024
1 parent ad41cdf commit 8644c73
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions calmerge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
def get_aiohttp_app(config: Config) -> web.Application:
app = web.Application()

app.middlewares.append(
aiohttp_remotes.XForwardedRelaxed(
num=int(os.environ.get("X_FORWARDED_NUM", 1))
).middleware
)

jinja2_env = aiohttp_jinja2.setup(
app,
loader=FileSystemLoader(templates.TEMPLATES_DIR),
Expand All @@ -24,12 +30,6 @@ def get_aiohttp_app(config: Config) -> web.Application:
],
)

app.middlewares.append(
aiohttp_remotes.XForwardedRelaxed(
num=int(os.environ.get("X_FORWARDED_NUM", 1))
).middleware
)

jinja2_env.filters["calendar_url"] = templates.calendar_url

app["config"] = config
Expand Down

0 comments on commit 8644c73

Please sign in to comment.