Empty line at the beginning of file

I have a route that returns a snippet to generate my xml feed

The route is as simple as this:
return new Response(snippet('rss', [] , true), 'application/rss+xml');

While the snippet itself is just a simple snippet to generate the feed. I’ll include only the first three lines since those are the ones relevant to the problem:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

I’m trying to figure out why the generate file I get in return has an empty line at the beginning
The screen is from the generated file I get doing a wget on the route and there’s the empty line at the beginning.
Screenshot 2022-08-22 at 11.52.31 AM

If you look at this example from the sitemap cookbook recipe, the first line in the snippet is echoed via PHP, probably exactly to prevent such issues?

<?= '<?xml version="1.0" encoding="utf-8"?>'; ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <?php foreach ($pages as $p): ?>
        <?php if (in_array($p->uri(), $ignore)) continue ?>
            <loc><?= html($p->url()) ?></loc>
            <lastmod><?= $p->modified('c', 'date') ?></lastmod>
            <priority><?= ($p->isHomePage()) ? 1 : number_format(0.5 / $p->depth(), 1) ?></priority>
    <?php endforeach ?>

So that results in this

Screenshot 2022-08-22 at 1.11.04 PM

Hm, I somehow cannot reproduce this issue. Make sure you have no hidden chars in your snippet.

So, here’s the thing: it doesn’t happen on my local machine but it does happen on the live site.

And I noticed that the same thing happens with the json version of the feed. And on there I don’t even have a snippet. I’m just returning an array from the route.

Check if any PHP file of your site has an empty line before or after the PHP tags. If it only occurs on the live server, maybe try redeploying everything.

Checked everything. No empty lines anywhere at the beginning or at the end of the files. Also everything is synced automatically via git and redeploying didn’t change anything unfortunately.