Why website is not auditable or readable for google? - amazon-web-services

Have created a staging website on Herokuapp and production on AWS but whenever trying to audit or speed testing it's giving an attached error
http://findmy-web.herokuapp.com/ staging -> hosted on heroku
https://www.gocatchy.com/ live -> hosted on AWS
Technology used = node and react

folks issue is resolved.
As I checked server-side config there was context URL response with status code 400
res.status(400).send(fullMarkup);
have updated with 200 and its works!

Related

Bad Request (400) in django web app in Azure App service while adding Custom Domain

In the Azure app service
my Website is working fine with something.azurewebsites.net with the following code
ALLOWED_HOSTS = [os.environ['WEBSITE_HOSTNAME']] if 'WEBSITE_HOSTNAME' in os.environ else []
But while adding a custom domain, it is showing as Bad Request (400). I think the problem relies on the Allowed host, and the Django app is not allowing my custom domain. I couldn't find a solution or a perfect line of code to resolve this issue.
Have you set up the custom domain in Azure? To do this, you can follow the steps in the Azure documentation:
https://docs.microsoft.com/en-us/azure/app-service/configure-custom-dns-web-site#map-a-custom-dns-name-to-an-azure-web-app
This will involve adding a CNAME record for your custom domain that points to your Azure app's default domain.
ALLOWED_HOSTS = [os.environ['WEBSITE_HOSTNAME'],os.environ['CUSTOM_HOSTNAME']]
CUSTOM_HOSTNAME should be added to the application configuration in azure.
Eg: CUSTOM_HOSTNAME: www.example.com

Nginx proxy pass is having 502/504 error and cannot reach the backend

I have a react project deployed inside an nginx docker container which is deployed on k8s which is on AWS.
I have a backend service which is deployed also on aws and I have a url to access it. It can be accessed directly on browser, on postman or my react app if I remove the proxy pass for this url, but I need the proxy pass to solve other issues.
It was working at the beginning and stopped working and I got 504, after trying every related solution from stack overflow, now I get 502 instead. And backend shows that nginx could never reach this backend.
There are many other backend Urls being used exactly the same way, and they are totally fine, it is just this one url which is not accessible.
I also have a local nginx running which never gives me issue on this backend Url, but even if I redeploy the react nginx server on aws and redeploy that backend service, it is still giving me 502. Any one have opinion on this weird issue?
Thank you for taking a look.
I tried every possible and related config for the locaton of this url in conf file. But none of them worked

AWS CloudFront + Lambda#Edge "The JSON output is not parsable"

I have a Lambda function (a packaged next.js app) which I'm trying to access via CloudFront. The web app works unless I try to hit the homepage.
When I hit /search or /video/{videoId} the page loads just fine.
When I try to hit the homepage, I get the following error page:
502 ERROR
The request could not be satisfied.
The Lambda function returned invalid JSON: The JSON output is not parsable. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: {id}
Why would just the homepage be invalid JSON? Where can I see this JSON to determine what is wrong? I created a mock Cloudfront request test in the Lambda function and it just returns successfully.
The problem was due to the 1 MB size limit of CloudFront Lambda#Edge responses. I didn't realize that Next.js's serverside rendering was creating a large <script id="__NEXT_DATA__"> tag on my homepage with all the fetched info from my API duplicated multiple times over. This resulted in my app's homepage being >2 MB.
I refactored my app to only send one network request, and made sure that data is only put into the __NEXT_DATA__ tag once. The app now works.

Connecting Next.js API with Next.js client on AWS Amplify

there is monorepo for development where are two folders - client, api. Developing on localhost is working very fine. But a problem, of course, is on AWS. My whole setting is in next.config.js which is
async rewrites() {
return [
{
source: '/api/:slug*',
destination: `${process.env.API_URL}/api/:slug*`
},
]
}
but this is not working on AWS Amplify. I suspect that should be more setting in Rewrites and redirects or AWS Cloudfront, but I don`t have any clue. Do you have some experience with that?
Error:
403 Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Problem was on client folder, where wasn't directory pages/api with any file and AWS CloudFront couldn't detect the directory for some internal settings. Look at the image bellow - There wasn't Path pattern - 'api/*', now it is. :)

serverless express/jade website on AWS

I am new to serverless, and try to build a simple express website on AWS with lambda and api gateway.
The site runs successfully on my local, but after deploying to AWS, there is a issue about jade route as AWS gives a stage name to deployed API, for example: the root(/) url is something like - https://opl3cla000.execute-api.ap-southeast-2.amazonaws.com/prod(the prod is stage name). While in my jade layout.jade, I have code like
ul.nav.navbar-nav
li
a(href="/page1") Page1
li
a(href="/page2") Page2
My jade code does not include the stage name, so it gives 403 as the path is https://opl3cla000.execute-api.ap-southeast-2.amazonaws.com/prod/page1 instead of https://opl3cla000.execute-api.ap-southeast-2.amazonaws.com/page1.
I am not sure if it is the correct configuration, and how can I fix it?
I use the middleware from awslabs/aws-serverless-express and get the answer from the author.
The reference link is below:
https://github.com/awslabs/aws-serverless-express/issues/11