Skip to content
pubscout

shelf_proxy

1.0.5, released 7 months ago by tools.dart.dev

A shelf handler for proxying HTTP requests to another server.

WASM-readyRock solid
$ flutter pub add shelf_proxy
Source repository

What it does

Provides a Shelf handler that proxies incoming HTTP requests to an external server. It can be served directly as a standalone proxy server or mounted within a larger Shelf application to proxy specific URLs.

AI-written summary of version 1.0.5, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building a backend server using Shelf and need to proxy requests to an external server.
  • You want to mount a proxy handler for specific URLs within a larger Shelf application.

Skip it when

  • You are not using Shelf for your backend routing.
  • You need a full-featured API gateway with complex routing rules and transformation capabilities beyond simple proxying.

Strengths

  • Integrates seamlessly with the Shelf ecosystem.
  • Can be used standalone or mounted within larger applications.
  • Correctly handles multiple Cookie and Set-Cookie headers.

Weaknesses

  • Limited to Shelf-based applications.
  • Basic proxying capabilities without advanced middleware features built-in.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
3

not documented

import 'package:shelf/shelf_io.dart' as shelf_io;
import 'package:shelf_proxy/shelf_proxy.dart';

void main() async {
  var server = await shelf_io.serve(
    proxyHandler("https://dart.dev"),
    'localhost',
    8080,
  );

  print('Proxying at http://${server.address.host}:${server.port}');
}

Alternatives

Packages that do the same job and could replace shelf_proxy.

Works with

Packages commonly used together with shelf_proxy: ones it builds on, ones built on it, and its own family.