Externally make a post request to a netlify background function

Hi is it possible to make a request to a netlify function ( background function ) externally (not from the app)?

In my case I need to run a script that would index the contents of my site that can be manually triggered from an external source.

@kyljmn-mg You could, but you may run into CORS errors, and would need to configure your function appropriately.

Any chance you know where to find how to do this in the docs? Been looking for it but I can’t seem to find it. Been testing this in a branch deploy, and calling the function via postman but I always get a 401 unauthorized response.

@kyljmn-mg I’m not aware of any Netlify specific documentation.

You would need to ensure the function responds to the appropriate headers, preflight request etc, it’s not going to occur by default.

See this related thread where I link to someone calling a Netlify function from a Webflow hosted website:

Turns out it wasn’t a CORS problem. Had some Basic-Auth header set up for the site. Just had to attach an Auth header to the request.

Excellent, great work.