Skip to content

Bypass www redirect for API and authentication requests - #32

Closed
atalyaalon wants to merge 1 commit into
mainfrom
fix-www-api-redirect
Closed

atalyaalon wants to merge 1 commit into
mainfrom
fix-www-api-redirect

Conversation

@atalyaalon

Copy link
Copy Markdown
Contributor

@tkalir: I opened this PR for your branch fix-www-api-redirect (commit 8598b61, unchanged) so your fix gets back to production and stays there.

What happened

  • Nov 28, 18:49 UTC: pushing this branch deployed it to dfc2 (run). Until Only deploy the anyway apps from main (stop deploys from any branch push) #27, the deploy workflows ran on a push to any branch. Your routing rule went live, and anyway-nginx was recreated.
  • Nov 30, 00:23 and 00:28 UTC: merging #27 and #24 redeployed main. main doesn't have this change, so the rule was removed from production again.
  • Side effect while it was live: the branch was based on the old main, so it also put dfc2's backup schedule back to daily. That's why dfc2 has daily dumps on Nov 29 and 30. Harmless, and monthly again since 00:28.

Since 00:23 UTC on Nov 30, www.anyway.co.il/api/…, /authorize/…, /callback/…, /user/… and /logout are redirected to anyway.co.il again. That's the behaviour this fix was meant to avoid.

The change

5 Traefik labels in apps-dfc2/anyway/compose.yaml: a higher-priority anyway-www-api router, so those paths on www.anyway.co.il are served directly by anyway-nginx instead of hitting the www → apex redirect.

Merging

  • It merges cleanly with current main. The result is main plus exactly these 5 lines; checked with git merge-tree.
  • The backup schedule stays monthly (10 0 1 * *), because the merge keeps main's version.
  • Merging redeploys dfc2 (dfc2 anyway CI). That applies the router and recreates anyway-nginx, a few seconds' blip, the same as on Nov 28.
  • dfc is not touched.
  • After the deploy, check that the paths behave as intended (no redirect on the listed paths), and that the dfc2 deploy log still shows 10 0 1 * *.

Nothing else from this branch is pending: it has only this one commit on top of the old main.


Generated by Claude Code

@atalyaalon
atalyaalon requested a review from ziv17 November 30, 2026 01:46
atalyaalon added a commit that referenced this pull request Nov 30, 2026
…eplaces #32 (#33)

* Bypass www redirect for API and authentication requests

* www API bypass: also cover the safety-data login routes, explain the rule

safety-data-client logs in with credentials via ${apiUrl}/sd-authorize/,
/sd-callback/ and /sd-user/ (anyway flask_app.py), which the bypass did
not cover. Adding them is harmless: same backend, only the redirect is
skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtN7GhfRRihvBTHsWxGZoV

* www API bypass: also cover safety-data's data routes (/involved, /city)

safety-data-client calls ${API_ANYWAY_URL}/involved, /involved/groupby and
/city with a JSON content type (preflighted CORS), which a redirect breaks
if that URL is www.anyway.co.il. Harmless otherwise: same backend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtN7GhfRRihvBTHsWxGZoV

---------

Co-authored-by: tkalir <tkalir@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Closing: replaced by #33, merged 2026-11-30 02:02 UTC (40f965c) and live on dfc2.

  • Bypass www redirect for API and login requests (incl. safety-data), replaces #32 #33 includes this PR's commit unchanged: Tamar's 8598b61, cherry-picked onto the latest main, with @tkalir still the author.
  • It adds the safety-data routes (/sd-authorize/, /sd-callback/, /sd-user/, /involved, /city) and a comment explaining the rule.
  • Verified after the deploy: www.anyway.co.il/api/… returns 200 with access-control-allow-origin: https://media.anyway.co.il, with no redirect.

The branch fix-www-api-redirect was left untouched; delete it whenever you like.


Generated by Claude Code

@atalyaalon atalyaalon closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants