Cloudflare Routing Map
Ailaaj.com Cloudflare Routing Map
Last verified: 2026-05-17
Purpose
This document is the single source of truth for how ailaaj.com should behave during the transitional Cloudflare Worker rollout.
The current goal is not to replace every existing origin yet. The goal is to:
- keep the live storefront on
ailaaj.pkfor now, - expose the other products under subdirectories on
ailaaj.com, - keep the existing subdomains alive as technical origins,
- enforce the apex subpaths as the canonical public URLs for users,
- preserve POS auth, cookies, service worker, downloads, and Vercel serverless behavior.
Verified current origins
| Public/current origin | Product | Repo | Notes |
|---|---|---|---|
https://ailaaj.pk | Live storefront | external Shopify | Remains the temporary apex fallback |
https://app2.ailaaj.com | POS / app upstream origin | ailaaj-connect-hub | Vercel-hosted; owns /api/*, sw.js, version.json, downloads/*; now served publicly as ailaaj.com/app/* |
https://one.ailaaj.com | Ailaaj One marketing site | one.ailaaj.com | Vite React app |
https://hospital.ailaaj.com | Hospital marketing site | hospital.ailaaj.com | Vite React app |
https://corporate.ailaaj.com | Corporate site | corporate | TanStack Start app |
https://talent.ailaaj.com | Talent / hiring portal | ailaajtalenthub | Vite React app on Vercel |
https://app3.ailaaj.com | Hospital login destination (formerly app2) | external/current app | Replaced app2; must stay unchanged |
Canonical public URL policy
During this phase, the subdomains remain the upstream origins, but users should end up on the apex subpaths as the canonical public URLs:
https://ailaaj.com/app/*https://ailaaj.com/one/*https://ailaaj.com/hospital/*https://ailaaj.com/corporate/*https://ailaaj.com/talent/*
Examples:
https://one.ailaaj.com/compare->https://ailaaj.com/one/comparehttps://hospital.ailaaj.com/platform->https://ailaaj.com/hospital/platformhttps://corporate.ailaaj.com/about->https://ailaaj.com/corporate/abouthttps://pos.ailaaj.com/login->https://ailaaj.com/app/loginhttps://talent.ailaaj.com/jobs->https://ailaaj.com/talent/jobs
To make that safe, origin-side canonical redirect logic must skip requests carrying:
x-ailaaj-public-host: ailaaj.com
That header marks internal origin fetches coming from the apex Cloudflare Worker and prevents redirect loops.
Phase 1 public behavior on ailaaj.com
Reserved product prefixes
Public URL on ailaaj.com | Upstream origin | Upstream path behavior | Notes |
|---|---|---|---|
/app | https://pos.ailaaj.com | Redirect to /app/login | Public entry for POS |
/app/* | https://pos.ailaaj.com | Strip /app before proxying | Example: /app/login -> /login |
/one | https://one.ailaaj.com | Serve homepage | |
/one/* | https://one.ailaaj.com | Strip /one before proxying | Example: /one/blog -> /blog |
/hospital | https://hospital.ailaaj.com | Serve homepage | |
/hospital/* | https://hospital.ailaaj.com | Strip /hospital before proxying | Example: /hospital/platform -> /platform |
/corporate | https://corporate.ailaaj.com | Serve homepage | |
/corporate/* | https://corporate.ailaaj.com | Strip /corporate before proxying | Example: /corporate/about -> /about |
/talent | https://talent.ailaaj.com | Serve homepage | |
/talent/* | https://talent.ailaaj.com | Strip /talent before proxying | Example: /talent/jobs -> /jobs |
Apex fallback behavior
For now, any request to ailaaj.com that does not match a reserved prefix or reserved support path should go to Shopify on ailaaj.pk.
Public URL on ailaaj.com | Temporary behavior |
|---|---|
/ | Redirect to https://ailaaj.pk/ |
| Any non-reserved path | Redirect to matching path on https://ailaaj.pk |
Reserved POS support paths on the apex host
These must stay available on ailaaj.com because the POS app still uses root-level serverless/API support paths in addition to /app/*.
Public URL on ailaaj.com | Upstream origin |
|---|---|
/api/* | https://app2.ailaaj.com/api/* |
/hub-version.json | https://app2.ailaaj.com/hub-version.json |
/hub-release.zip | https://app2.ailaaj.com/hub-release.zip |
/spa-manifest.json | https://app2.ailaaj.com/spa-manifest.json |
POS support files under /app
These are also required and must resolve correctly through the /app prefix.
| Public URL | Upstream |
|---|---|
/app/sw.js | https://app2.ailaaj.com/sw.js |
/app/version.json | https://app2.ailaaj.com/version.json |
/app/downloads/* | https://app2.ailaaj.com/downloads/* |
/app/hub-version.json | https://app2.ailaaj.com/hub-version.json |
/app/hub-release.zip | https://app2.ailaaj.com/hub-release.zip |
/app/spa-manifest.json | https://app2.ailaaj.com/spa-manifest.json |
Required edge behavior in the Cloudflare Worker
This routing cannot be handled correctly with DNS alone. It requires a Worker because the edge must do all of the following:
- Match prefixes like
/app,/one,/hospital,/corporate,/talent. - Strip the public prefix before forwarding to the existing upstream origin.
- Rewrite Location headers so upstream redirects stay inside the public prefixed path.
- Rewrite absolute upstream hosts in HTML/JS/CSS/text responses:
https://app2.ailaaj.com->https://ailaaj.com/apphttps://one.ailaaj.com->https://ailaaj.com/onehttps://hospital.ailaaj.com->https://ailaaj.com/hospitalhttps://corporate.ailaaj.com->https://ailaaj.com/corporatehttps://talent.ailaaj.com->https://ailaaj.com/talent
- Rewrite root asset URLs such as
/assets/...to prefixed paths like/one/assets/...,/hospital/assets/...,/corporate/assets/...,/talent/assets/...,/app/assets/.... - Rewrite common static root paths like favicon/robots/sitemap/OG image references to their prefixed equivalents where needed.
- Preserve POS root support paths like
/api/*on the apex host. - Fallback non-reserved traffic to Shopify on
ailaaj.pk.
Verified code readiness by repo
ailaaj-connect-hub
Status: ready for Worker phase 1
Verified:
- production build passes,
- router is
/app-aware, - service worker registration is
/app-aware, - version checks are
/app-aware, - downloads manifest/install flow is
/app-aware, - several hard redirects were changed to respect
/app, - root-level
/api/*serverless usage still exists and must be proxied on the apex host, - SEO metadata is apex-aware with
og:url: https://ailaaj.com/app/loginand canonical URLs.
Important note:
- the built HTML still emits root asset URLs like
/assets/..., so the Worker must rewrite those to/app/assets/..., - upstream origin is now
app2.ailaaj.com(formerlypos.ailaaj.com; see domain migration notes).
Key files:
src/lib/appBasePath.tssrc/App.tsxsrc/main.tsxpublic/sw.jsvercel.json
one.ailaaj.com
Status: ready for Worker phase 1 with edge rewriting
Verified:
- production build passes,
- router basename support exists,
- canonical/public URL helper exists,
- login CTA now points at
https://ailaaj.com/app/login, - internal links use a base-path helper,
- sitemap script accepts
SITE_URL/VITE_PUBLIC_SITE_URL.
Important note:
- static/built HTML still emits root asset URLs like
/assets/..., - default source HTML still contains subdomain canonical/meta values,
- therefore the Worker must rewrite text responses for public
/onebehavior.
Key files:
src/lib/public-url.tssrc/App.tsxsrc/components/SEO.tsxscripts/generate-sitemap.mjs
hospital.ailaaj.com
Status: ready for Worker phase 1 with edge rewriting
Verified:
- production build passes,
- router basename support exists,
- canonical/public URL helper exists,
- structured-data URL normalization exists,
app2.ailaaj.com/loginremains intentionally unchanged.
Important note:
- built HTML still emits root asset URLs like
/assets/..., - source/static HTML still defaults to subdomain canonical/meta values,
- therefore the Worker must rewrite text responses for public
/hospitalbehavior.
Key files:
src/lib/public-url.tssrc/App.tsxsrc/components/SEO.tsxscripts/generate-sitemap.mjs
corporate
Status: ready for Worker phase 1 with edge rewriting
Verified:
- production build passes,
- TanStack router basepath support exists,
- public URL helper exists,
- business-unit links were aligned to apex public paths.
Important note:
- this app still needs the Worker to expose it under
/corporate/*, - SSR/client asset paths remain rooted at
/assets/..., so the Worker must rewrite public responses accordingly.
Key files:
src/lib/public-url.tssrc/router.tsxsrc/routes/index.tsxsrc/components/business-units.ts
ailaajtalenthub
Status: ready for Worker phase 1 with edge rewriting
Verified:
- runtime router basename support now exists,
- canonical/public URL helper exists,
- direct
talent.ailaaj.com/*browser visits can be redirected tohttps://ailaaj.com/talent/*, - Vercel redirect rules now skip requests carrying
x-ailaaj-public-host, - shared job links and auth reset links now resolve to the apex public path.
Important note:
- built HTML still emits root asset URLs like
/assets/..., - therefore the Worker must rewrite text responses for public
/talentbehavior.
Key files:
src/lib/public-url.tssrc/App.tsxsrc/main.tsxsrc/pages/JobDetails.tsxvercel.json
custom_store_front_ailaaj
Status: not part of phase 1 public cutover
Verified:
- production build passes,
- repo is available for the later storefront cutover,
- current SEO/canonical source of truth is still
https://ailaaj.pk.
Implication:
- this is not the current apex target for
ailaaj.com, - phase 1 should keep apex fallback on Shopify,
- phase 2 can replace Shopify fallback with this repo once storefront cutover is approved.
Key files:
src/lib/seo.tssrc/server.ts
Existing Worker script in repo
The verified Worker source file is:
cloudflare/ailaaj-com-router.js
That script already implements the core phase 1 design:
/app,/one,/hospital,/corporate,/talentprefix routing,- prefix stripping before origin fetch,
/app->/app/loginredirect,- apex
/api/*routing to POS, - Shopify fallback for non-reserved paths,
- host replacement inside text bodies,
- root
/assets/*rewriting to prefixed asset paths, - POS rewrites for
/app/sw.js,/app/version.json, and/app/downloads/*, - Location header rewriting for redirects.
Cloudflare dashboard requirements
Before enabling the Worker on ailaaj.com, do the following:
- Disable/remove the current apex redirect rule that sends
ailaaj.comtoailaaj.pk. - Attach the Worker to the appropriate route for the apex host.
- Make sure no higher-priority redirect/page rule overrides Worker execution.
- Keep the existing subdomain origin mappings unchanged:
app2.ailaaj.com(upstream origin for publicailaaj.com/app/*)one.ailaaj.comhospital.ailaaj.comcorporate.ailaaj.comtalent.ailaaj.com
- Keep
app3.ailaaj.comunchanged (new hospital login destination, replacing formerapp2.ailaaj.com).
Recommended rollout order
- Deploy/attach the Worker for
ailaaj.com. - Verify:
/one/hospital/corporate/talent/app/login/app/sw.js/app/version.json/app/downloads/latest.json/api/*from the public apex host
- Keep monitoring subdomain fallbacks directly.
- Later, replace Shopify fallback with
custom_store_front_ailaajwhen storefront cutover is approved.
Final phase 1 summary
During phase 1:
ailaaj.comis not yet the new storefront,- it is the public umbrella host,
- Shopify remains the fallback storefront,
/one,/hospital,/corporate,/talent, and/appare exposed through Cloudflare Worker path-based proxying,- the direct subdomains remain alive as technical origins,
- the apex subpaths are the canonical public URLs users should land on.