# Serve model endpoint api via public url

**URL:** <https://deeptalk.lambda.ai/t/serve-model-endpoint-api-via-public-url/4470>\
**Category:** Uncategorized\
**Created:** [January 21, 2025, 11:59am UTC](https://deeptalk.lambda.ai/t/serve-model-endpoint-api-via-public-url/4470 "2025-01-21T11:59:56Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![damowerko](https://sea1.discourse-cdn.com/flex019/user_avatar/deeptalk.lambda.ai/damowerko/32/703_2.png) [@damowerko](https://deeptalk.lambda.ai/u/damowerko)\
**Post date:** [January 23, 2025, 6:49pm UTC](https://deeptalk.lambda.ai/t/serve-model-endpoint-api-via-public-url/4470/3 "2025-01-23T18:49:19Z")

</div>

Adding to what @cody_b said…

You will need a couple other things as well:

- Public facing IP address OR port forward. If you have a dedicated public IP for your machine that is easiest – this is most common at universities which have big blocks of IPs. Alternatively, you need access to some machine on the network (like the router) which has a public IP, then you can do a reverse-proxy on that machine or port forward 80 and 443.
- You will need to obtain a domain name. Whoever you rent a domain from, there will be a portal where you can “create DNS records” (assign IP address to the domain). For example, if you have `lambda.com` and you assign it to your machine with public IP 10.0.0.1 then all requests to `lambda.com` will go to `10.0.0.1:80`.
- (Optional, Recommended) Setup HTTPS. These days this is pretty straightforward. If you don’t do this, every time someone visits the site via browser they will get a warning that “connection is not secure”.

# Recommended tools

I highly recommend to use caddy as a reverse-proxy. It can do a lot more, like being a full web server, but I love it because it has great docs and in my view its super simple to configure. With caddy you would do two things:

- Setup reverse proxy.
- Automatically setup HTTPS.

Caddy uses a config file called a `caddyfile` which for your use case could be as follows.

```auto
example.com
reverse_proxy /api/* 127.0.0.1:8080

```

In the above example any HTTPS request to `example.com/api/*` will be forwarded to `127.0.0.1:8080` (localhost port 8080).

> **[Reverse proxy quick-start - Caddy Documentation](https://caddyserver.com/docs/quick-starts/reverse-proxy)**
>
> Caddy is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go

> **[HTTPS quick-start - Caddy Documentation](https://caddyserver.com/docs/quick-starts/https)**
>
> Caddy is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go

# What is a reverse-proxy?

Usually HTTP and HTTPS requests are made on port 80 or 443. A reverse-proxy looks at the URL of the request and forwards it to a specific port. For example, you could map `http://api.lambda.com` to 192.168.1.1:8080, `http://docs.lambda.com` to 192.168.1.1:8081, and `http://lambda.com/contact` to 192.168.1.2:8080. There is lot of things you can do, but in general, you are intercepting HTTP/HTTPS requests and remapping/forwarding them.

---

_[View the full topic](https://deeptalk.lambda.ai/t/serve-model-endpoint-api-via-public-url/4470)._
