svenstaro/miniserve

support backend proxy like trunk

Closed this issue · 7 comments

trunk has a function that can proxy a /path url to a bakend server url address http://xxxx/path, like this:

trunk serve --proxy-backend=http://xxxx/path

trunk web site is here:
https://github.com/thedodd/trunk

I'm not sure how this fits miniserve's use case. What's the story here?

Thanks for your reply!

Becuse today's web sites are builted with separate front-end and back-end, now i have a front-end project ,and i want to access the back-end data while debugging the front-end page, so if my front-end project run with miniserve , and could access the back-end data, that must useful !!!

We already have an Single Page Application mode via miniserve --spa --index index.html. Is this not useful for your case?

It's have no proxy function, i can't use it to access the back-end server data.

I think the more proper way would be to use nginx or something like in in front of miniserve. You can use nginx as a reverse proxy then to access miniserve and your backend. In my opinion this feature is out of scope for miniserve.

Yeah, normally people would use something like the webpack dev server proxy for something like this so I think it's indeed rather out of scope for miniserve.

When i use miniserve as a tool to develop spa, proxy to backend api like what webpack or trunk do can really useful. And it fast and tiny.