#✅ - AWS Amplify 301 error
28 messages · Page 1 of 1 (latest)
Hello,
This is my next-config.js file:
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
So i'm guessing i didn't
I did just notice this code tho:
layout.tsx uses this
export const metadata: Metadata = {
metadataBase: new URL(ENV.NEXT_PUBLIC_WEBSITE_URL),
Which is imported from constants.ts
export const ENV = {
NEXT_PUBLIC_WEBSITE_URL: process.env.NEXT_PUBLIC_WEBSITE_URL || 'http://localhost:3000',
NODE_ENV: process.env.NODE_ENV || 'development'
}
Maybe this could be the problem?
But then why does it work on the default amplifyapp.com domain tho?
Yeah it seems unlikely to be the cause since the amplifyapp.com subdomain is resolving as expected. Do you have any kind of redirects or forwarding setup with CloudFlare?
Those are the dns records we use to activate the domain on the app. I was referring to this: https://developers.cloudflare.com/rules/url-forwarding/
I have 0 rules defined
Got it, thanks for confirming. I am investigating into this further.
https://main.dwvfgo10j5m70.amplifyapp.com
This is btw the amplifyapp.com domain (maybe it can help kinda doxxing myself tho)
Today I did transfer the domain from combell to cloudflare. But I got a verification mail that cloudflare is now managing the domain. So i'm guessing this has nothing to do with it either. Just trying to confirm all edge cases
This is good to know, once you transferred the domain to cloudflare was the domain resolving as expected (before it was connected to the app)?
Yes it worked fine before connecting it to aws
I just turned off the proxy. I'm now able to surf to the site
it is weird tho. My friend did the exact same and it is working for him with proxy enabled
Ah okay, i see the custom domain is now resolving. What does this specific proxy setting do?
With the proxy settings its easier to apply waf rules. And other sorts of protection
I'll try to figure out a fix. Thanks for the help tho
It seems when you proxy a CNAME DNS record, the traffic will resolve to Cloudflare's IPs, allowing Cloudflare to optimize, cache, and protect the requests.
Btw. Kinda new to this all as you can tell.
But now that the proxy is disabled. I have higher chances of getting ddosed etc.
i'm using aws free tier, is there anyway i can define a max budget. So when the requests go over the amount the free tier has I don't go broke
@willow wolf You can refer to this documentation to get started with setting up a budget that notifies you after your spending exceeds AWS Free Tier limits: https://docs.aws.amazon.com/cost-management/latest/userguide/budget-templates.html
You can also explore setting up alarms to notify you when a certain threshold of requests are exceeded on your app: https://docs.aws.amazon.com/amplify/latest/userguide/access-logs.html#monitoring-with-cloudwatch
Lastly, Amplify Hosting provides a managed infrastructure to host static and dynamic web apps. The resources associated with the Amplify apps such as CloudFront distribution, S3 bucket etc. are managed by the service. CloudFront distributions by default have AWS shield standard enabled which protects against DDoS attacks: https://docs.aws.amazon.com/waf/latest/developerguide/ddos-standard-summary.html.
✅ - AWS Amplify 301 error