'Amplify and Goddady forwarding to www subdomain

Hello people I have an issue regarding Amplify and Godaddy, hosting a next.js site.

I'll explain the issue in list so I don't write too much and be as clear as possible.

  1. I Have a GoDaddy account to which I have only delegated access to domains
  2. I have deployed a next.js site (using SSR) on amplify
  3. Eventually, I'll need to add the root domain to Goddady, but the issue is that amplify needs to add the root domain in an ANAME, not a CNAME which GoDaddy does not support.
  4. I forward the root domain, to a www subdomain like so: https://www.example.com
  5. When I access my browser my site, for example: example.com (without the www or any protocol) it redirects me perfectly to my website.

The problem

If I go to my site like this: https://example.com, it loads nothing and sends a PR_END_OF_FILE_ERROR. I can only access my site with: example.com or www.example.com. And this issue is because, on amplify, when I set the domains, I'm setting the www.example.com with the actual branch code. Since I cannot add an ANAME to GoDaddy because ANAME's are not supported, the root domain has to be disabled like so: enter image description here

Possible solutions?

I cannot have access to all the products of GoDaddy and change nameservers.

I did add a 301 forwarding in GoDaddy from the root domain to the www subdomain. But still, accessing https://example.com does NOT redirect to the www.example.com one.

Is using Nginx a solution? or probably a raw .htaccess file? I mean, I don't care if the domain goes to a www, I just need it to redirect it.

PD: On amplify I have my redirections as well: enter image description here

I'll appreciate a lot your help, It's been 3 days and nothing. 😔



Solution 1:[1]

Because of this:

test.cpp:45:11: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   45 |     Print(1);
      |           ^

So convert it to a universal reference:

template <typename T>
void Print( T&& value ) // notice &&, that's a universal reference, not an rvalue ref
{
    std::cout << value << std::endl;
}

Solution 2:[2]

1 is an rvalue, and so cannot bind to T&. It can bind to const T& though.

That is,

void Print(const T& value)

or

void Print(T&& value)

are the fixes.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 digito_evo
Solution 2