Skip to content

vercel.proxy (draft) - #196

Draft
ricardo-agz wants to merge 1 commit into
mainfrom
ricardo/proxy-py
Draft

ricardo-agz wants to merge 1 commit into
mainfrom
ricardo/proxy-py

Conversation

@ricardo-agz

@ricardo-agz ricardo-agz commented Jul 24, 2026 •

Copy link
Copy Markdown
Collaborator

vercel.json

{
  "services": {
    "frontend": { ... },
    "backend": { ... }
  },
  "proxy": { "entrypoint": "proxy.py" }
}

proxy.py

from vercel.proxy import Proxy, Request, Route, redirect, rewrite
from vercel.proxy.matchers import cookie, header, host, query


async def dashboard(request: Request):
    if request.cookies.get("session") is None:
        return redirect("/login")
    return None


proxy = Proxy(
    routes=[
        Route(
            "/dashboard/{path:path}",
            dashboard,
            has=[host("{tenant}.example.com"), cookie("session")],
            missing=[header("x-blocked")],
        ),
        Route.rewrite(
            "/legacy/{path:path}",
            "/new/{path}",
            has=[query("migrate", "1")],
        ),
        Route.redirect("/docs", "/documentation", status_code=308),
    ]
)

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Jul 24, 2026 12:21am

Request Review

This branch had an error being deployed

1 failed and 1 active deployments
ci — f110771f Deployed Jul 24, 2026 by ricardo-agz via test (py3.14) #746
Preview — f110771f Deployed Jul 24, 2026 by vercel[bot]
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.

1 participant