How to host multiple reactJs web app under one domain in amplify? - amazon-web-services

I've 2 different reactJs applications which can be deployed independently to aws-amplify. Is there a way I can configure them to the different context paths of the same domain?
www.mydomain.com/app1
www.mydomain.com/app2
Is it possible using amplify?

Right now there is no way to deploy multiple projects with different subdirectories on the same domain using different amplify projects.
But there is a way to deploy multiple projects under the same domain name in a single amplify project instance. If your project is using a monorepo style of structuring the projects. You can read more about it here .

The closest thing I've figured out is adding subdomains before
Let me know if you figure this out because I'm trying to do the same thing
I'll keep you posted as well

Amplify documentation says you can use "200 redirects" (or "Reverse proxy rewrite") to deal with this issue.
cf. https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
I quote :
Rewrite (200)
200 redirects (rewrites) are intended to show content from the
destination address as if it were served from the original address.
Search engine ranking history continues to apply to the original
address. Redirection occurs on the server-side, so a browser
navigation bar shows the original address after redirection.
So you may want to create 2 redirect rules :
/app1/<*> https://app1.mydomain.com/<*> 200
/app2/<*> https://app2.mydomain.com/<*> 200
(choose any domain/subdomain you want for your app1 and app2)

Related

Allow users to add custom domain pointing to a subdomain in my app on Google Cloud Platform

I am trying this since last 2 days.
I build an example app using a very detailed tutorial here - https://john2x.com/blog/wildcard-certs-from-lets-encrypt-cert-manager-ingress-nginx-gke.html
What I have working right now:
I have an app running at demo-app.example.com wherein users can have their own subdomain like john.demo-app.example.com
I got the wildcard certificates working as well
I have two questions now:
1 - How do I allow users to add their custom domain pointing to the subdomain in my app. When I just create a CNAME pointing to a subdomain in my app, it does not work, I think because of how the whole thing is configured.
2 - I want to move from demo-app.example.com to just example.com to the top level, so how should the DNS zone be configured for this?
Finally, given the requirements, is Kubernetes the best I could use or I would be better off using something else. It is a NodeJS app btw.

How to do URL masking with Django?

On a Django 1.9 project I need to redirect:
https://example.com/app/
to
https://examplebucket.s3.amazonaws.com/app/index.html
But I need https://examplce.com/app/ to be still visible on the browser address bar...
I know this must be possible in theory with Django because the previous team working on this project did a setup to serve the /static/ media files from an S3 bucket. And if I access those static files via https://example.com/static/app/index.html, they are served from the S3 bucket but the browser address bar still shows the original url I input.
I'm deploying an Ionic Browser project and I want the files (including the index) to be served from the S3 but the url needs to be user friendly, thats the reason.
The old (dirty) way of doing this is frame-based forwarding.
You set up an iframe on a page in /app/ which points at the real app, letting the url stay the same.
It's not considered a good practice because of security issues (can't be sure where you are typing credentials into), and bookmarking issues (url is always the same so can't bookmark inner pages).
Another alternative is to set up a proxy script that just takes the url, turns that into the equivalent aws url, downloads it and then returns it. This would break the benefits of your cloud hosting if it has multiple regions... it would always be passed through the bottleneck of your server.

Run fuel php app in AWS EC2 instance

I have a fuel php application created by one of my friend.Now I want to run it on aws EC2 instance(ubuntu).I can run the application using apache2 and its index page is loading.After facebook connect from index page it is supposed to show my fb friends list. But it is showing a 404 error POST http://ec2xxxxcompute.amazonaws.com/ajax/auth/facebook not found
I can see a get_facebook() method inside controller(/ajax/auth.php).But it is not catching the method.My top level understanding is i need some url mapping in server level.
Can anyone help me to run the app.Any suggestion will be highly appreciated as a biginner
Are any other URL's loading, or only the index page? If that is the case, it might be a rewriting issue.
Is the default .htaccess file still included in the /public folder? Or did your friend change it?
You may not actually be calling your php code at all. Don't you need something like :
http://ec2xxxxcompute.amazonaws.com/ajax/auth.php/facebook

How do I make Django figure out which Site object to use based on "Host" header in the HTTP request?

Consider a Django app built to serve multiple sites with slightly differing content using the standard Django sitesframework.
The traditional way to host this would be to configure multiple Site objects and setup the app in multiple Django projects with each project pointing to a different SITE_ID in their respective settings.py:s.
For various reasons I'd like to avoid having to create a new project for each new site. I want to be able to setup one project and have Django figure out which Site object to use based on the hostname referenced in the incoming HTTP request.
What is the recommended way to achieve this functionality?
Clarification: I want the site framework to ignore settings.SITE_ID (which is hard-coded in settings.py) and instead dynamically fetch Site objects based on what is in the Host header. Why this requirement? I'll be adding and removing sites multiple times per hour and the total amount of sites will exceed 10,000, so setting up a Django project for each site is not an option. Is this a problem that is solvable in Django? If so, what is the best way to achieve it?
The recommended way is to not attempt it at all, since settings should never change at runtime. Instead, set a variable in your virtual host configuration and have the WSGI adapter script or settings module pick one of the sites based on that.

Sitecore Multisite using querystring instead of domain/subdomain?

Is there a way to setup mulitple sites to run using querystrings rather than domains/subdomains?
I am developing a site that has a Global site and multiple country specific sites (exact list of countries to be confirmed later). For development I have a Global and a Local site created and running on a temporary subdomain. If this works correctly we may run the entire application this way rather than on separate domains (similar to how apple.com appears to work)
I have successfully got the sites running locally as:
global.domain.com
a.domain.com
b.domain.com
but would like them to be able to run as:
www.domain.com/global
www.domain.com/a
www.domain.com/b
We will be implementing multiple languages on certain country sites aswell so locale will need to remain independant.
Could this be done using some sort of URL mapping rather than multiple sites or something? Where can I find information about URL mapping?
There are settings for using virtual folders (see web.config under sites node)
virtualFolder: The prefix to match for incoming URL's.
This value will be removed from the URL and the remainder will be treated as the item path.
How that works in practice I'm not sure - it's on a domain by domain basis, and all your sites will be operating from the same domain.
But I think you might want to reconsider your approach. Sub domains have several advantages. They're simple to configure in the web.config (just add a domain and point it at the right bit of the content tree).
They simplify search engine optimisation - e.g. telling google to target a specific subdomain to a geographical area in Google webmaster tools.
They're simple for visitors to understand.
Bear in mind that if you're going to use multiple languages per site then you will probably want to keep the language parameter in the URL as part of the (virtual) filepath (e.g. www.mysite.com/en-GB/products)
If you use both language and locale in the URL in that way you end up with something like www.mysite.com/UK/en-GB/products