Can different websites hosted at different providers use the same domain, safe for the subdomain? - subdomain

My client has a domain (let's say www.clientdomain.com) which is linked to a Woocommerce store hosted at GoDaddy.
I'm currently deploying an application consisting on a Flask API and a React SPA. The Flask API will be hosted at PythonAnywhere, while the React SPA is deployed at Firebase hosting.
Can I use www.clientdomain.com/<api_name> as the domain for the API, and www.clientdomain/<frontend_application> even although the root domain (www.clientdomain.com) directs to a different application at a different hosting?

Yes, you can use a subdomain of your client's domain (e.g. api.clientdomain.com) for your Flask API, and another subdomain (e.g. frontend.clientdomain.com) for your React SPA. This is possible because subdomains are treated as separate domains, even though they are part of the main domain.
Keep in mind that we are speaking about subdomains, www.clientdomain.com/<api_name> and www.clientdomain.com/<frontend_application> are directory of the main domain, they aren't subdomains
To use a subdomain for your Flask API, you will need to create a subdomain in your domain's DNS settings, and then point that subdomain to the IP address of your PythonAnywhere server. You can then configure your Flask API to be accessible at that subdomain.
Similarly, you can create another subdomain for your React SPA and point it to the IP address of your Firebase hosting server. This will allow you to access your React SPA at that subdomain.

Yes, you can host your Flask Api on your subdomain, it will be something like flask.yourdomain.com. It won't impact anything to your main site.

Related

Express backend & React frontend under the same domain

I have a backend in Express.js deployed on Elastic Beanstalk and a frontend built with React.js deployed on Amplify and I would like to make HTTP (using axios) requests from the frontend to the backend via relative paths.
I'm quite new to AWS but I figured I could use Cloudfront to set the backend as a behaviour?
I have a domain (mydomain.com) for the frontend where the DNS are pointing to Amplify cloudfront (which I think I can't access...) and Elastic Beanstalk has its own aws domain (http://app-name.region.elasticbeanstalk.com/).
The frontend seems to be working fine as if I go to mydomain.com I can see it. Also the backend seems to be working as if I go to http://app-name.region.elasticbeanstalk.com/api/user it would return the expected json data.
The idea would be though that mydomain.com serves my React application which internally would make calls to, for example, mydomain.com/api/user where my express backend would serve the user.
I got lost in the docs and on the internet didn't really find anything.
Is using Cloudfront the right approach? If so, how do I connect Amplify and Elastic Beanstalk?
Any suggestion would be very appreciated!

json rest api, locally hosted, lan accessible

For some time now I try to figure it out how to create a json rest api and a database, host it locally and make it accessible in lan. I need this for an android app, exactly to parse data from database to app.
I created the json rest and database usimg XAMP but i didn't figure it out how to make them accessible from lan.
After that somebody recomanded me IIS and since then I did'n figure it out.
Some sugestions?
For the web api application, host in the IIS server in some other system. In the mobile application development environment is in same LAN network, then call the api using that web api system ipaddress instead of the localhost.

Openshift 3 communication between deployments

I'm just learning OSE 3. I'd like to deploy two Node.js Web applications I have created. So I have created a Project with two Node.js deployments, which are now running in their own Pod.
My question is, how are they supposed to communicate ? say for example one application needs to redirect to the other, or include components from the other application.
Should I hardcode the route of each application in a configuration file or so ?
Thanks!
For internal communication between the two services, you can use the name of the service as the host name when making connections. This is possible because the name of the services are added to an internal DNS server so that a host name lookup on the name will yield the correct IP for the service at that time. When the service has multiple pods, an internal IP load balancer will automatically route the request to one of the pods.
For the question about redirects, that seems to suggest you have both services exposed publicly and want to have one service return a HTTP response that redirects the HTTP client to a URL which falls to the other service. What the redirect URL needs to be is going to depend on how you are exposing the services. That is, whether each service is exposed as a different hostname or you have used path based routing of OpenShift to overlay one at a sub URL of the other under the same host.
Either way, you probably want to use an environment variable passed in via the deployment configuration to indicate to the service triggering the redirect, to tell it what the URL prefix is that it needs to redirect to. You would manually set this up. This at least means you haven't hardwired it in your code.
If you mean something else by redirect, you will need to explain better what you mean.

Subdomain to html

First of all I want to say that I'm new to the workings of DNS and server behavior.
Now I recently purchased a domain name, which redirect to my VPS IP adress.
on my linux VPS I have 2 folders with html files:
/var/www/html/home (containing):
home.html
/var/www/html/admin (containing):
admin.html
Since on the dns you can only type in an IP adress i don't know how to redirect the following:
admin.domain.nl -> html/admin/admin.html
domain.nl -> html/home/home.html
I want to have this working before launching a Java EE application.
You don't do that type of routing using DNS.
DNS maps a hostname to an IP addresses, so your DNS configuration would look like this (using made-up IP addresses):
domain.nl A 123.45.67.89
admin.domain.nl CNAME domain.nl.
Then you configure your web server (Apache?) to serve different content based on the hostname included in the HTTP request. This is called "virtual hosts" in apache.
How to set this up is off-topic for StackOverflow

External IP address appears instead of Domain Name

I am running a website in Google Compute Engine and configured a DNS zone and an A record to point to the IP address where my web-server runs. In my domain registrar (GoDaddy), I changed name-servers to point to Google name servers.
I can browse to the website without issues, but it show the IP address of the server instead of domain name. How can I change that to show domain name such as www.example.com instead?
I have a website hosted in GCE running under a Linux machine Apache Server. I created an A record in my DNS pointing to the external IP address of the server. When I access the link the subdomain name is not replaced by the IP. I do not believe your issue is particularly related to Compute Engine.
Particularly if you are using WordPress you will need to change some configuration files as stated in
http://codex.wordpress.org/Changing_The_Site_URL
https://wordpress.org/support/topic/browser-displaying-ip-instead-of-domain-name
The below solution worked for me,
GCP set IP Address as site URL when you deploy WordPress on google cloud.
Please change it to your domain name,
WordPress Admin Panel >> Settings >> Site URL (& WordPress URL as
well) >> add your domain name into textbox
Attached is the image for your reference.