Creating URL Slugs in AWS Lamba / Node functions - node.js

I am created my first aws lambda/serverless app as I want it to scale but perform like an MVC app and blog with many pages. Perfer a tech news site where each article is a separate url as opposed to an AJAX Gmail type of application
Is it possible to do this? I don't want my urls to be mydomain.com/ride.thml but instead to be mydomain.com/pick-up-wild-rydes-unicorn.
Any tutorials besides the aws wild rydes one would be helpful.
I have used cakephp in the past but worry about scaling it horizontally (or any mvc type application).
Thanks.

There's a couple of ways, essentially you need to use the slug as a URL parameter variable.
Create a Hosted Zone for your domain in Route 53
Create an API in API Gateway and put the slug part as a URL Parameter
The routing will probably require a stage directory (e.g. v1) this is ok.
The API will have a generic AWS URL + your stage.
Assign your Route 53 custom domain <your domain> to direct to <API Gateway url>/<stage>/ such that you only need to request <your domain>/<slug>.
Access the {slug} parameter from your Lambda function and serve the appropriate content

Related

Selecting custom domain in Azure API Management

I have a shared instance of API Management that has two custom domains associated with it. These two custom domains are:
team1Naming.company.com and team2Naming.company.com
Right now when I create a new API it always defaults to using team1Naming.company.com for all APIs. What I want is for all APIs in team1Product to use team1Naming.company.com as the base url and all APIs in team2Product to use team2Naming.company.com as the base url.
Does anyone know how to set a different base url on certain APIs?

Restrict access for website to Front Door only without custom domain - is it possible?

I would like your feedback and opinion about using { FrontDoor + Appservices + Authentication + restrict access to FD only }
I do confirm I can set up all of this thanks to all contribution/ forums / blog found on the net. I can use my custom domain which request AD authentication and I am correctly redirect to my appservices (in browser: I see my custom domain name and never see any *.azurefdnet or *azurewebsites.net as expected).
The only problem is that I needed to use a custom domain to make it works. For production purpose it is acceptable to have a custom domain but for dev or test I wonder if we can do it without custom domain by simply keeping original address like *.azurefd.net and *.azurewebsites.net
I struggle to make it works without custom domain. I keep getting “too many redirection” message or ‘403 sites blocked’.
Does anyone success to do it ? My general configuration looks like
My backend is linked with my appservices
Details of my backend is:
I think my problem is with BackendHostHeader but not sure. When i used custom domain for my production it works. But remind i do not want to use custom domain for dev and test.
My route looks like
And finally my appservices is secure to allow frontdoor only
When my user goes to stackoverflo.azurefd.net they get AD authentication which is good but just after i get redirection to xxx.azurewebsites.net with 403 forbidden (which looks normal because of restriction to FD only).
I tried to change the backend host header by replacing by FD value but in this case i get a error with loop redirection.
Is it a feasible scenario without custom domain ?
Regards
PS: i configured Azure ADApp to allow reply url to my FD like stackoverflo.azurefd.net/.auth/login/aad/callback
Yes, you can Restrict the access to website without using Custom Domain.
Goto the Application you want to restrict the access in Azure Portal and select the Networking from left Pane, now click on Access Restrictions.
For complete information you can go through this Microsoft Documentation.

How to block crawling of the origin when Azure CDN is configured

something is not clear using Azure CDN.
I explain step by step what I have done since my website has been created. Call my website www.mypublicwebsite.com. So:
I created a web app on Azure. The website has the following url: https://mypublicwebsite.azurewebsites.net;
I created a custom domain www.mypublicwebsite.com
I redirected all the request from https://mypublicwebsite.azurewebsites.net to www.mypublicwebsite.com. So I solved the problem of duplicated contents for crawlers.
Everything is fine. Then, I decided to create CDN, according the documentation. Here the confusion starts.
I created the CDN profile
I created the endpoint. The endpoint has a new url https://mypublicwebsite.azureedge.net
I deleted the custom domain from web app;
I created the custom domain in cdn profile.
So the current state is this:
This situation is really problematic for SEO!! It cannot be the correct configuration. My contents are triplicated.
I partially solved the situation:
I redirected all the request from https://mypublicwebsite.azureedge.net to www.mypublicwebsite.com. So I solved the problem of duplicated content for crawlers.
But crawler (and perhaps users?) can still navigate the origin web site. I have been looking for different solutions:
Make a redirect from https://mypublicwebsite.azurewebsites.net to www.mypublicwebsite.com. But this create a infinite redirects loop between the CDN and the origin.
Try to hide the origin, but how?
I am honestly starting thinking this is not the correct way to manage cdn.
Can anyone help me please?
Thank you

Azure Web App Service / Rest API - How to upload a website page

I have a web app service on azure that is hosting a RESTful api which deals with my MySQL database. I am wondering if its possible to somehow (either manually, or otherwise) upload a page to this app service as well. For instance, i have my URL from azure, and my API lives under /api
I was wondering if i can create a php/html page or something that I can upload to /meetingConfirm
so i can do something like /meetingConfirm?id=hash
And have a page which i can send email links to encoded for each meeting, to allow people to respond to invites. It would be a simple page that just updates a value via the API and then displays a confirmation.
For this, you don't need a separate page to be uploaded for each user. You can just add a multi-threading Id generator code and save the last used Id in your DB for future requests.
I am referring to a solution like this(as I am not sure about your tech stack, sharing python approach): How do you generate random unique identifiers in a multi process and multi thread environment?

How can i create an api endpoint or api with particular domain using nodejs?

I am trying to create a saas and for that, I need to create an API and I am not sure how can I create an endpoint like this https://api.karix.io/message/ here domain is https://api.karix.io and endpoint is the message. I know how to create an API using nodejs but not sure how can I create for the domain-specific.can anyone help me with this problem?
A domain is basically a link to an ip-adress. There are DNS-Servers who transate between the human readable form and the ip.
If you want to run your app on a specific domain you need to purchase that domain (which can be quite costly) and the dns Server will create a link between the domain name and ip adress.
So basically you dont need to do anything in order to create the rest-api for your domain.
Later the request are similiar to this:
https://api.karix.io/message/
http://192.168.111.111:80/message <- The ip obviously differs in production
The name of the domain should be accessible in your request-Object atleast in the express framework.

Resources