R
RunPod3mo ago
susmitha

I want to get a Public Url

I want to deploy my web app in RUNPOD and get a public url which i can use as a webapp. My Web app should open anytime and anywhere. Is this possible with on demand pods?
2 Replies
Madiator2011 (Work)
yes just set http port and make sure your app runs on 0.0.0.0
Encyrption
Encyrption3mo ago
There are 2 ways to do that. You can map a HTTP port. Map a HTTP port in your template and you can get a RunPod Proxy URL to it. In this example using port 8888:
POD_ID = os.getenv('RUNPOD_POD_ID')
WS_PORT = 8888

URL = f'https://{POD_ID}-{WS_PORT}.proxy.runpod.net'

print(f'You can connect to URL {URL}'
POD_ID = os.getenv('RUNPOD_POD_ID')
WS_PORT = 8888

URL = f'https://{POD_ID}-{WS_PORT}.proxy.runpod.net'

print(f'You can connect to URL {URL}'
or you can use a TCP port. Again, in this example using port 8888:
RUNPOD_PUBLIC_IP = os.getenv('RUNPOD_PUBLIC_IP')
RUNPOD_TCP_PORT = os.getenv('RUNPOD_TCP_PORT_8888')

URL = f'http://{RUNPOD_PUBLIC_IP}:{RUNPOD_TCP_PORT}'

print(f'You can connect to URL {URL}'
RUNPOD_PUBLIC_IP = os.getenv('RUNPOD_PUBLIC_IP')
RUNPOD_TCP_PORT = os.getenv('RUNPOD_TCP_PORT_8888')

URL = f'http://{RUNPOD_PUBLIC_IP}:{RUNPOD_TCP_PORT}'

print(f'You can connect to URL {URL}'
With TCP you can see I am using http instead of https. As, with TCP it is direct connection to your Pod and if you want to implement https your Pod has to be configured for SSL and have a SSL certificate installed. Both of these solutions are assuming your image has been coded to listen on the port you have mapped. These examples use Python but you can use any language you are familiar with.
Want results from more Discord servers?
Add your server