Reputation: 659
Essentially, i have a netlify function that's at the path - http://<auto-generated-name>.netlify.app/.netlify/functions/index
. I followed the instructions on the netlify dashboard to setup a custom domain, but with that setup, i have to go to http://<custom-domain>.com/.netlify/functions/index
to access my app.
I want to set up my custom domain so that all requests to http://<custom-domain>.com
go DIRECTLY to the function, and NOT to the root http://<auto-generated-name>.netlify.app
domain. How do I do that?
Edit: I tried adding redirects in the netlify.toml
file, and that does work, but I'm still curious if there's a way to "directly" point the domain to the function instead of redirecting requests.
Upvotes: 0
Views: 271
Reputation: 6752
You could perhaps host a simple html page at index.html
which runs some JS to call your function.
But most likely you just want to do a netlify redirect with the 200
status code, as that configuration will leave the original URL intact and make it look like it is hosted and not being redirected.
Depending on your netlify and caching setup this would actually run on first page load, with the redirect effectively never happening.
Upvotes: 1