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

# Development

> Learn how to develop applications for Laravel Vapor.

## Binary Responses

To return binary responses, such as PDF downloads, from your Vapor application, your HTTP response should include the `X-Vapor-Base64-Encode` header:

```php theme={null}
return $response->withHeaders([
    'X-Vapor-Base64-Encode' => 'True',
]);
```

<Warning>
  Lambda limits responses to 6MB. If you need to serve a larger file, consider returning a signed, temporary S3 URL that your user may use to download the file directly from S3.
</Warning>

## Configuring OpenSSL

To use certain OpenSSL functions such as [openssl\_pkey\_new](https://www.php.net/manual/en/function.openssl-pkey-new.php), you must create an `openssl.cnf` configuration file and instruct Vapor to load it via the `OPENSSL_CONF` environment variable. For example, this environment variable will instruct Vapor to load an `openssl.cnf` file from the root of your project:

```ini theme={null}
OPENSSL_CONF="/var/task/openssl.cnf"
```

An example `openssl.cnf` file is available below:

```ini theme={null}
dir = certificates

[ ca ]
default_ca = CA_default

[ CA_default ]
serial = $dir/serial
database = $dir/index.txt
new_certs_dir = $dir/newcerts
certificate  = $dir/cacert.pem
private_key = $dir/private/cakey.pem
default_days = 36500
default_md  = sha256
preserve = no
email_in_dn  = no
nameopt = default_ca
certopt = default_ca
policy = policy_match

[ policy_match ]
commonName = supplied
countryName = optional
stateOrProvinceName = optional
organizationName = optional
organizationalUnitName = optional
emailAddress = optional

[ req ]
default_bits = 2048
default_keyfile = priv.pem
default_md = sha256
distinguished_name = req_distinguished_name
req_extensions = v3_req
encyrpt_key = no

[ req_distinguished_name ]

[ v3_ca ]
basicConstraints = CA:TRUE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always

[ v3_req ]
basicConstraints = CA:FALSE
subjectKeyIdentifier = hash
```

## "After Response" Jobs

In typical Laravel applications, you may dispatch jobs that will be executed after the HTTP response is sent to the browser:

```php theme={null}
Route::get('/', function () {
    dispatch(function () {
        Mail::to('taylor@example.com')->send(new WelcomeMessage);
    })->afterResponse();

    return view('home');
});
```

However, we recommend that you always dispatch jobs to your queue workers when using Vapor. Vapor is not able to execute a job after sending a response to the browser; therefore, attempting to do so will cause your application to appear slower to the end user.

## Inertia SSR

Currently, Inertia server-side rendering (SSR) is not available on Vapor environments due to constraints of AWS Lambda. For applications requiring [Inertia with SSR capabilities](https://inertiajs.com/server-side-rendering), we recommend:

* **[Laravel Cloud](https://cloud.laravel.com/docs/compute#inertia-ssr)** - Our fully-managed Laravel application platform.
* **[Laravel Forge](https://forge.laravel.com/docs/sites/laravel#inertia-server-side-rendering-ssr)** - Our VPS server management platform.
