Ignore netlify "browser" (fetching preview image) access to page after build/deployment in my scripts

Hi there,

is there a way to ignore the netlify “browser”/ site access after deploy build?
I guess this is to fetch a preview image of the web page for the netlify admin panel.

By evaluating the the header I see a referrer beginning like this https://main--.
Is it save to assume this ref can be used to filter for “netlify browser access”?
Or is there another way or header I could use to filter?

hi @pa-nic -

sorry to be slow to get back to you, i think we’re having trouble following.

Can you describe what you are trying to do in a different way perhaps?

Sorry to get here just after Perry, but I do understand what you are asking. Yes, that sounds like it is for our screenshot service, and is subject to change without notice (all things about how we request it - from user agent to URL).

What kind of filtering do you want to do, exactly? What are you trying to accomplish?

Hi @perry and @fool,

thanks for getting back to this.

I’ve setup a “hit counter” for my static page:
An img with a link to a Netlify function as source. The function returns a base64 encoded image and updates a hit counter (faunadb).

I just want to ignore the hits generated by your “screenshot service” after each build as I’ve also setup a GitHub action for daily rebuilds.

Filtering by ‘https://main–’ works so far. But if this is

I wondered if there is a better solution…

Ah, well, we only create the screenshot right after a deploy. So, you could subtract the number of deploys you have from the counter, I guess, if you don’t like filtering.

I have also asked our developers if there is a predictable user agent you can filter on via javascript, and will let you know what they say (likely next week).

Wanted to follow up to let you know that we’ve filed a feature request for a unique user-agent for our screenshot service, which would help with this- if that ships, we’ll be sure to let you know!

Thanks @fool and @jen.
A unique user-agent would be great :wink: