Exposing your app to the internet
In the ever-evolving landscape of web development and deployment, the manner in which applications are exposed to the internet plays a pivotal role in determining their accessibility, performance, and overall user experience. When deploying your application, you have the option to expose it to the internet using two different methods: CDN (Content Delivery Network) or Anycast.
What you'll need
Before you dive in, make sure you have the following prerequisites in place:
- A bunny.net account ( Log in or sign up for a free trial).
- Ensure that you have already set up the application you want to configure. See our quickstart guide if you haven't set up an application yet.
CDN configuration
A CDN is a system of distributed servers that work together to deliver web content, such as images, videos, and scripts, to users based on their geographical location. It helps improve website performance, reduce latency, and enhance the overall user experience.
CDN can be used to create an Edge Endpoint through which containers of the application can be accessed. Any container running a process that is serving HTTP(S) traffic can be exposed using CDN.
Note
For more information about CDN, see our CDN documentation .
Configuration steps
To expose your app to the internet by using CDN configuration, follow the steps below:
-
Login to bunny.net dashboard .
-
Navigate to the Magic Containers section and select the app you want to modify.
-
Click on Endpoints and Add New Endpoint.
- Select CDN under the type.
- You need to name the endpoint (it must have a unique name).
- Specify the container port for every container.
Note
It is recommended to have one process running within a container. If multiple processes are running, ensure they operate on different ports.
- Specify whether your application inside the container uses SSL for origin (this feature is only applicable for CDN).
- Click Add Endpoint.
Sticky session
bunny.net also provides you with the sticky session feature to enhance your application's user experience by ensuring session persistence across multiple requests.
Sticky session is a method used in load-balanced environments to ensure that all requests from a single client are directed to the same server instance where the user's session was initially established. This is crucial for applications that maintain state information across multiple interactions with a user.
The primary advantage of using sticky sessions is the ability to maintain a stateful interaction with the user. This is particularly useful for applications where user actions on the server need to be remembered within the session context.
To enable sticky session, follow the steps below:
- In the endpoint configuration window select Sticky Session.
- You need to choose headers such as X-Forwarded-For or User-Agent, or use cookies like SessionID to maintain session consistency.
- Click Add Endpoint.
Upon the first request, the load balancer assigns the session to a specific server based on the chosen identifier and subsequent requests continue to route to the same server.
Anycast configuration
Anycast is a network addressing and routing methodology that enables multiple servers to share the same IP address. When a user makes a request, the network routes it to the nearest (in terms of network distance) Anycast node, improving performance and reliability.
The Anycast option will map containers to Anycast IP and expose it on the specified port.
Configuration Steps
To expose your app to the internet by using Anycast configuration, follow the steps below:
-
Login to bunny.net dashboard .
-
Navigate to the Magic Containers section and select the app you want to modify.
-
Click on Endpoints and Add New Endpoint.
- Select Anycast under the type.
- You need to name the endpoint (it must have a unique name).
- Specify the Container Port for every container.
- Define the Exposed Port, which is the port on which the application will be available on the Anycast IP.
- When Anycast is selected, the platform will associate an Anycast IP. Specify the container port within the container and the exposed port to be used in combination with the Anycast IP to expose the application.
- Click Add Endpoint.
Need help or encountering issues?
If you encounter any difficulties or have questions while following this Quickstart Guide, our support team is here to assist you. Please don't hesitate to contact us via support request form for prompt assistance.
Our dedicated support team is ready to help you resolve any issues you might face during the deployment process, provide additional guidance, or answer your questions.
Updated 3 days ago