trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.
https://trunkrs.dev/
Apache License 2.0
3.53k stars 255 forks source link

Implement the proxy server. #33

Closed thedodd closed 4 years ago

thedodd commented 4 years ago

abstract

The trunk serve command needs the ability to proxy some URLs to a configured backend, particularly for cases where the UI makes requests to backend data APIs on the same host which served the UI application, nested under a different URI prefix. This is a very common deployment pattern.

todo

Trunk.toml-only proxy config

related issues

29

31 (though this one will require separate treatment and functionality)

jgrund commented 2 years ago

add support for ignoring invalid certs.

Was this implemented? I am seeing the following when trying to proxy to a dev server with a self-signed cert:

Caused by:
    0: error sending request for url (https://localhost:7443/messaging/): error trying to connect: invalid certificate: UnknownIssuer
    1: error trying to connect: invalid certificate: UnknownIssuer
    2: invalid certificate: UnknownIssuer
Feb 18 16:47:33.355 ERROR response failed classification=Status code: 500 Internal Server Error latency=140 ms
rogusdev commented 1 year ago

The feature you are looking for exists but is undocumented: --proxy-insecure as a cli arg like:

trunk serve --proxy-backend=https://localhost:3001/ --proxy-insecure --proxy-rewrite=/api/

The docs need updating at https://trunkrs.dev/configuration/#proxy-cli-flags and I have asked how to do that.

This was added in https://github.com/thedodd/trunk/commit/41e4a6089dbc3fc73b9c5b0f0d48565f8b199b49

rogusdev commented 1 year ago

Oh, I see that @jgrund was the one who in fact added it :) Thank you!

rogusdev commented 1 year ago

https://github.com/thedodd/trunk/pull/611 PR for docs