galileo_proxy 3.0.0 icon indicating copy to clipboard operation
galileo_proxy: ^3.0.0 copied to clipboard

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

proxy #

Pub build status

Galileo middleware to forward requests to another server (i.e. webdev serve). Also supports WebSockets.

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

main() async {
  // Forward requests instead of serving statically.
  // You can also pass a URI, instead of a string.
  var proxy1 = Proxy('http://localhost:3000');
  
  // handle all methods (GET, POST, ...)
  app.fallback(proxy.handleRequest);
}

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

Proxy(baseUrl, publicPath: '/remote');

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

Proxy(baseUrl.replace(path: '/path'));

Request bodies will be forwarded as well, if they are not empty. This allows things like POST requests to function.

For a request body to be forwarded, the body must not have already been parsed.

1
likes
100
pub points
0%
popularity

Publisher

verified publisher icongalileodart.com

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

Homepage

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

galileo_framework, http, http_parser, path

More

Packages that depend on galileo_proxy