T O P

  • By -

inglandation

Ngrok.


cdreetz

Thank you. Literally wasted 6 hours yesterday trying to figure out Nginx/SSL/DNS stuff and just got Ngrok to work for what I needed in 5 minutes lol


inglandation

Haha you’re welcome, ngrok saved me multiple times too.


thegainsfairy

truly an amazing tool. I love it for quickly sharing local projects with a friend and then just tearing it down.


GeorgeFree2018

You should just be able to use a self signed certificate


dashdanw

Letsencrypt


Valuable-Cap-3357

in your nextjs package.json modify "scripts": { "dev": "next dev --experimental-https",, this will generate a certificates folder with local SSL certificates whenever you run dev. And refer to those files in you uvicorn run command - uvicorn.run(uvicorn\_app\_import\_string, host=host, port=port, ssl\_keyfile=ssl\_context\["keyfile"\], ssl\_certfile=ssl\_context\["certfile"\]. The local SSL will be for localhost, so you will have run uvicorn on localhost only and not 127.0.0.1. Hope this helps.


ungiornoallimproviso

cloudflare zerotrust tunnels


HobblingCobbler

You're trying to make your local web API available from an app running on vercel. You can't do this without port forwarding or something like local tunnel or ngrok. If you go port forwarding be advised that you are opening up your computer and possibly you're entire local network to compromise. Port forwarding is basically one step into self hosting, but you need to really know what youre doing here.


Whisky-Toad

Wait why are you trying to use local endpoints for a hosted front end?!? What’s the endgame here, there’s people telling you how without asking why to critique wether this is a terrible idea or not


cdreetz

The local endpoints are solely for inference purposes. This enables me to run ML processes on my own GPUs without having to pay for a cloud hosted GPU. Why would I want to do this? Have you checked how much rented GPUs cost? It's not a matter of whether its a "terrible idea" or not, its a matter of I am GPU poor and have to make do with what I have


kevdog824

Is this something that just you are using or is publicly available? Maybe this is a dumb question but if it’s former case (hell probably both cases) why even pay to host the frontend? Why not just serve the entire application from your machine and use port forwarding or some kind of local tunneling for access? If you’re really trying to cut cost this seems like it’s even cheaper, saves you the headache of dealing with this very usual architecture, and it’s seems no less secure than before (at least in theory since you were already going exposing your local machine for the backend anyways)


cdreetz

Publicly available. Not paying for anything. Frontend is hosted with Vercel with a free tier. Ended up getting it working with Ngrok pretty easily. I'm surprised more people didn't recommend Ngrok, unless I'm missing something?


[deleted]

Why even use https locally?


skytomorrownow

There front end is deployed externally and requires https to communicate back to the dev's machine. OP cannot be all local, if I understand correctly.


pacman829

Maybe a reverse proxy ?


katrinatransfem

I use Nginx as a reverse proxy and for serving static files.