angel_proxy 2.0.0 copy "angel_proxy: ^2.0.0" to clipboard
angel_proxy: ^2.0.0 copied to clipboard

outdated

Angel middleware to forward requests to another server (i.e. pub serve).

proxy #

Pub build status

Angel middleware to forward requests to another server (i.e. webdev serve).

import 'package:angel_proxy/angel_proxy.dart';
import 'package:http/http.dart' as http;

main() async {
  // ...
  
  var client = http.Client();
  
  // Forward requests instead of serving statically
  var proxy1 = Proxy(client, 'http://localhost:3000');
  // or split: Proxy(client, 'localhost', port: 8080, protocol: 'http');
  
  // handle all methods (GET, POST, ...)
  app.all('*', proxy.handleRequest);
}

You can also restrict the proxy to serving only from a specific root:

Proxy(client, '<host>', publicPath: '/remote');

Also, you can map requests to a root path on the remote server

Proxy(client, '<host>', mapTo: '/path');

If your app's keepRawRequestBuffers is true, then request bodies will be forwarded as well, if they are not empty. This allows things like POST requests to function.

0
likes
0
pub points
0%
popularity

Publisher

verified publisherangel-dart.dev

Angel middleware to forward requests to another server (i.e. pub serve).

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

angel_framework, http, http_parser

More

Packages that depend on angel_proxy