How to make free tier login url work with www. and without it

Hi

I am using the free tier at this moment. I am in production and I noticed that if user is accessing without www. the site it will cause an error. If user access the site and need to login using with www. it will work nicley. How can I sync everything to work with www. and without?

will not work- https://domain.co

will work - http://www.domain.co

If i push the user from: https://domain.co to http://www.domain.co it wont work.

the implementation is in nextjs.

im having issues with the baseurl