galileo_proxy

Last updated:

0 purchases

galileo_proxy Image
galileo_proxy Images
Add to Cart

Description:

galileo proxy

proxy #


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);
}
copied to clipboard
You can also restrict the proxy to serving only from a specific root:
Proxy(baseUrl, publicPath: '/remote');
copied to clipboard
Also, you can map requests to a root path on the remote server:
Proxy(baseUrl.replace(path: '/path'));
copied to clipboard
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.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.