Deploy a public Langflow server
By default, your Langflow server at http://localhost:7860
isn't exposed to the public internet.
However, you can forward Langflow server traffic with a forwarding platform like ngrok or zrok to make your server public.
When your Langflow server is public, you can do things like deploy your Langflow MCP server externally, serve API requests, and share a flow's Playground publicly.
Prerequisites
On the machine where you plan to host your Langflow installation, install Langflow and a reverse proxy or forwarding service.
This guide uses ngrok, but you can use any similar reverse proxy or forwarding platform.
If you want to follow along with this guide, install ngrok and create an ngrok authtoken.
Expose your Langflow server with ngrok
-
Start Langflow:
_10uv run langflow run -
In another terminal window, use your ngrok authtoken to authenticate your local ngrok server:
_10ngrok config add-authtoken NGROK_AUTHTOKEN -
Use ngrok to expose your Langflow server to the public internet:
_10ngrok http http://localhost:7860This example assumes that you use the default Langflow listening address at
http://localhost:7860
. If you have a different listening address, you must modify this command accordingly.The ngrok session starts in your terminal and deploys an ephemeral domain with no authentication. To add authentication or deploy a static domain, see the ngrok documentation.
The
Forwarding
line prints the forwarding address for your Langflow server:_10Forwarding https://94b1-76-64-171-14.ngrok-free.app -> http://localhost:7860The forwarding address acts as a reverse proxy for your Langflow server, and ngrok forwards your local traffic to this domain.
-
To verify that your Langflow server is publicly available, navigate to the forwarding address URL, such as
https://94b1-76-64-171-14.ngrok-free.app
.
Use a public Langflow server
When your Langflow server is public, you can do things like deploy your Langflow MCP server externally, serve API requests, and share a flow's Playground publicly.
Deploy your MCP server externally
After you deploy a public Langflow server, you can also access your Langflow projects' MCP servers publicly.
To do this, use your server's forwarding address when you connect a client to a Langflow MCP server.
Serve API requests
To send requests to a public Langflow server's Langflow API endpoints, use the server's domain as the base URL for your API requests. For example:
_10curl -X POST \_10 "PUBLIC_SERVER_DOMAIN/api/v1/webhook/FLOW_ID" \_10 -H "Content-Type: application/json" \_10 -H "x-api-key: LANGFLOW_API_KEY" \_10 -d '{"data": "example-data"}'
When you create flows on public Langflow servers, the code snippets generated in the API access pane automatically use your public server's domain.
You also use your public domain when making Langflow API calls in scripts, including the code snippets that are automatically generated by Langflow.
For example, the following code snippet calls an ngrok domain to trigger the specified flow (d764c4b8...
):
_29import requests_29_29url = "https://3f7c-73-64-93-151.ngrok-free.app/api/v1/run/d764c4b8-5cec-4c0f-9de0-4b419b11901a" # The complete API endpoint URL for this flow_29_29# Request payload configuration_29payload = {_29 "output_type": "chat",_29 "input_type": "chat",_29 "input_value": "Hello"_29}_29_29# Request headers_29headers = {_29 "Content-Type": "application/json",_29 "x-api-key": "LANGFLOW_API_KEY"_29}_29_29try:_29 # Send API request_29 response = requests.request("POST", url, json=payload, headers=headers)_29 response.raise_for_status() # Raise exception for bad status codes_29_29 # Print response_29 print(response.text)_29_29except requests.exceptions.RequestException as e:_29 print(f"Error making API request: {e}")_29except ValueError as e:_29 print(f"Error parsing response: {e}")
For a demo of the Langflow API in a script, see the Quickstart.
Share a flow's Playground
After you deploy a public Langflow server, you can use the Shareable Playground option to make a flow's Playground available at a public URL. If a user accesses this URL, they can interact with the flow's chat input and output and view the results without installing Langflow or generating a Langflow API key.
For more information, see Share a flow's Playground.