> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salad.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Networking / Container Gateway

*Last Updated: October 10, 2024*

Networking is a crucial aspect of any modern application. In Salad, it is particularly important to have a good
understanding of two types of networking requests: outbound and inbound. Outbound networking involves sending data from
your application to other APIs or services, while inbound networking involves receiving https requests by your
application from other servers or services.

## Outbound Network Requests

When your application runs on a SaladCloud node, it will have the ability to make any outbound requests using the
residential IP address of the selected node. This means that your application will have the ability to access websites
and other online resources using a different IP address than your server, which can be particularly useful for tasks
such as web scraping and online market research. Additionally, because the IP address is associated with a residential
location rather than a datacenter, your requests are less likely to be blocked or flagged as suspicious, enhancing the
reliability and effectiveness of your application. Overall, running your application on a SaladCloud node provides a
powerful tool for accessing online resources and conducting online research in a more efficient and effective manner.

### Outbound Networking Information

* The IP address will be the residential IP address of the particular node running your application
* The hostname will be set to the unique SaladCloud machine id, this is the same value as the `SALAD_MACHINE_ID`
  environment variable.

## Inbound Network Requests

If your application needs to receive http requests from external services, SaladCloud provides a simple networking
solution that will automatically load balance the inbound requests across all the container instances running within a
specific container group. This feature is particularly useful for applications that require high availability and
scalability. Furthermore, load balancing ensures that incoming requests are distributed evenly across all instances,
which in turn improves the overall performance of the application, reduces latency, and prevents any one instance from
becoming overloaded. With SaladCloud's Container Gateway solution, you can rest assured that your application will be
able to handle a large volume of traffic without encountering any issues related to scalability or availability.

Each container group can be configured to include inbound networking via the Container Gateway feature. For each
container group, you will need to specify the port that your application uses to handle http requests. This is necessary
to ensure that SaladCloud can automatically create a static URL with a load balancer, which allows you to send requests
directly to your container group. As you scale your container group up or down, SaladCloud will automatically manage the
load balancer, allowing you scale without additional configuration. Additionally, your container will need to accept
IPv6 connections. To test and if needed enable IPv6 connections, see
[Sending authenticated requests to your container](/container-engine/how-to-guides/gateway/sending-requests)

We support options for both authenticated (recommended) and unauthenticated networking. If authentication is selected,
you must include your SaladCloud API key when making requests to your application, see
[Sending authenticated requests to your container](/container-engine/how-to-guides/gateway/sending-requests). If
authentication is not selected, any traffic to the domain name will go to your container. In this case authentication
should be completed by your container.

> 📘 Requesting a unique URL for each node
>
> Create container groups with only one replica each. Because each container group has a unique URL assigned to it, this
> approach allows you to uniquely address each node. To manage large numbers of nodes/replicas, we recommend using the
> API.

### Container Gateway Requirements

* Your application support IPv6
* All requests to the SaladCloud load balancer must be over HTTPS

### What is the maximum request size I can send?

The maximum request size is set to 1 GB by the Container Gateway and its related services.

To follow best practices for processing large files, we recommend that you architect applications using a pull model
rather than a push model:

1. Put the large files in Cloud Storage, such as AWS S3，Cloudflare R2 or YouTube. Select the appropriate service tier
   and lifecycle policy (Hot/Warm/Cold/Archive) based on their access patterns to optimize costs.
2. Following the principle of least privilege, grant access to these files for your containers on SaladCloud.
3. Send the jobs (file URL and metadata) to the containers via the Container Gateway.
4. Ensure your container application will receive the url, download and process the files and provide the results.
