trunk icon indicating copy to clipboard operation
trunk copied to clipboard

Support serving over TLS

Open BafDyce opened this issue 3 years ago • 2 comments

Some web application features (e.g., accessing the clipboard) is restricted to localhost and https pages for security/privacy reasons. However, sometimes you'll want to test the application from another device (e.g., smartphone) so you'd need https for these features to work.

Currently my workaround is to use a python web server launched in the dist/ directory which uses a TLS certificate generated on startup. Unfortunately, using this approach one loses the auto-reload feature. Another possible workaround would probably be to setup a proxy that also passes through websockets to trunk.

However, the easiest way in the long-term would be that trunk serve directly supports https. Ideally with both, tls certificate generated at startup and using a previously generated certificate.

I understand that this might not be a priority for now but I still wanted to drop the suggestion. Unfortunately, I don't think that I have enough time implementing it myself in the weeks to come.

BafDyce avatar Nov 22 '21 18:11 BafDyce

+1 please, as it seems HTTPS is one of the requirements for PWAs. My workaround is similar, using https://github.com/joseluisq/static-web-server (Rust) and https://github.com/FiloSottile/mkcert (Go).

evilrobot-01 avatar Jan 06 '22 13:01 evilrobot-01

+1, I also need this

maurerdietmar avatar Mar 04 '22 10:03 maurerdietmar

+1

lukaselmer avatar Apr 16 '23 13:04 lukaselmer

+1, currently using a (kind of hacked-together) fork (https://github.com/thedodd/trunk/compare/master...murosuke:trunk:develop) for this.

@thedodd It would be really nice if this could be merged and released.

Update: https://github.com/thedodd/trunk/pull/532 was merged into trunk-ng. Use https://crates.io/crates/trunk-ng.

lpotthast avatar Jul 17 '23 16:07 lpotthast

+1, just to pop up this issue for the author

Arjentix avatar Oct 11 '23 10:10 Arjentix

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Nov 11 '23 00:11 github-actions[bot]

The workaround is indeed to use mkcert and some local proxy. The documentation needs to be updated to show that trunk actually already supports this use case, but the feature is currently undocumented, waiting on my PR to alert others to it: https://github.com/thedodd/trunk/pull/611/files

rogusdev avatar Nov 11 '23 15:11 rogusdev

This was merged back into trunk (from trunk-ng) and is released with trunk 0.18.0.

ctron avatar Dec 13 '23 10:12 ctron