Creating and deploying a tiny proxy server on Vercel in 10 minutes

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • vercel

    Develop. Preview. Ship.

  • // In Vercel, any file inside the "api" directory is exposed on an "/api" endpoint. // For an API route to work, you need to export a function as default (a.k.a request handler), // which then receives the following parameters: // - req: The request object. // - res: The response object. // See https://vercel.com/docs/serverless-functions/supported-languages#node.js for details. export default async function handler(req, res) { res.status(200).send(`Hello world!`); }

  • pinboard-api-proxy

    Tiny proxy server to allow all origins to fetch the Pinboard API

  • I recently created a tiny proxy server to edit responses of a public API on the fly, and I was impressed by how easy it is to build and deploy such things on Vercel. In my case, the goal was to allow all origins to fetch the Pinboard API by adding an "Access-Control-Allow-Origin": "*" header to the API response, but there are plenty of other cases where a proxy server may come in handy.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • http-proxy-middleware

    :zap: The one-liner node.js http-proxy middleware for connect, express, next.js and more

  • // Create a proxy to redirect requests of the "/api/*" path to "https://example.org". // // Examples: // GET /api/hello β†’ GET https://example.org/hello // POST /api/test?color=red β†’ POST https://example.org/test?color=red // // Additionally, the proxy will: // - Add an "x-added" header // - Remove the "x-removed" header // From the proxied response. // // You can/should update the proxy to suit your needs. // See https://github.com/chimurai/http-proxy-middleware for more details. const { createProxyMiddleware } = require('http-proxy-middleware'); const apiProxy = createProxyMiddleware({ target: "https://example.org", changeOrigin: true, pathRewrite: { "^/api": "" // strip "/api" from the URL }, onProxyRes(proxyRes) { proxyRes.headers['x-added'] = 'foobar'; // add new header to response delete proxyRes.headers['x-removed']; // remove header from response } }); // Expose the proxy on the "/api/*" endpoint. export default function (req, res) { return apiProxy(req, res); };

  • http-proxy

    A full-featured http proxy for node.js

  • Check the documentation of the http-proxy-middleware library (and of the node-http-proxy library, used under-the-hood) to learn how you can manipulate the proxied request & response.

  • node

    Node.js JavaScript runtime βœ¨πŸ’πŸš€βœ¨

  • So, here’s how you can create and deploy a tiny but flexible Node.js proxy server on Vercel in 10 minutes.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts