Menu

Python Developers Can Now Write Routing Middleware on Vercel
📰

Python Developers Can Now Write Routing Middleware on Vercel

WebProNews·John Overbee·about 3 hours ago
#YQhNMgUX
#webpronews#news#vercel#photo#article
Reading 0:00
15s threshold

Vercel has opened its Routing Middleware to Python, a change that lets teams building on FastAPI, Flask, Django and other Python frameworks rewrite, redirect or answer requests before they ever reach the application.

The middleware, described in a Vercel changelog post Wednesday, is an ASGI or WSGI app that runs separately from the main application.

Setup takes two pieces. Developers point the proxy entrypoint in vercel.toml at their middleware, then list the packages it imports in a vercel.proxy dependency group in pyproject.toml. The middleware runs with only the packages in that group.

Vercel also published a vercel-proxy package with helpers, including a Proxy app that routes requests by path. The sample in the announcement sends old blog URLs to new ones with a 308 redirect and adds an API version header to requests under /api before passing them along. Requests that match no route reach the app unchanged.

It was one of several changelog items Vercel posted Wednesday.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.