i have 2 website :
site1.com (IP: 1.1.1.1) and site2.com (IP: 2.2.2.2) (not on the same server and hoster)
I would like to have a subdomain on site1.com (sub) who redirect to site2.com :
sub.site1.com redirect to site2.com
The redirection must be invisible to the user.
When on sub.site1.com, url display is sub.site1.com and note site2.com.
To be more precise:
On the site1.com, i do:
sub.site1.com CNAME site2.com
site2.com CNAME machine.host.com
machine.host.com A 2.2.2.2
It works but i have the generic page of machine.host.com.fr when i call sub.site1.com.
2.2.2.2 (machine.host.com) is a web server who have multiple site on it.
How to be more specific and redirect sub.site1.com to my site ?
If I understand correclty you need a DNS alias to make the job.
Suppose you have two domains :
site1.com (A) 1.1.1.1
site2.com (A) 2.2.2.2
If you want a new site1.com subdomain pointing site2.com, you need to make a CNAME (alias) register to point site2.com
sub.site1.com (CNAME) site2.com
A possible solution if you want to load another site content (without change the main domain), is load the remote content with an Iframe. With this, you can load remote content invisible to the user.
Related
I have a laravel projct deployed on a virtual machine on GCP and I need to create a subdomain for it based on its url , the url looks like this : 34.90.86.243/questions_bank/public/
but when I wanted to add the url to the data field on google domains I got confused on what type I should use to make this up to work.
see this image
so which type should I choose ? and if there is an other way to do it please tel me
You cannot create subdomains based upon URL paths (/questions_bank/public/).
DNS servers manage subdomain resource records based upon IP addresses (A and AAAA) and CNAMES (which resolve to A and AAAA resource records.
If your goal is to create a subdomain questionsbank as in questionsbank.example.com from the IP address 34.90.86.243, create an A with the Host name questionsbank, Type A, TTL 86400, Value 34.90.86.243.
In your webserver (Apache, Nginx, etc.) you can use URL Rewrite to map subdomains to URL paths.
E.g. I have two backend services, A and B, and I want to forward everything with path
/A* to A and /B* to B - but I want to strip out the /A/ and /B/ before it hits them. So for example /A/api reaches A as /api. Is this possible?
Edit: I specifically want to forward the traffic, not redirect.
I don't think it's possible, what worked for me is simply configuring my backends so that locally I can start them without the context, and then when deployed, a context is added.
I think you can do redirect rewrite rule, this content is for forcing https redirection but I am assuming you can do a redirect to a diff url as well:
https://aws.amazon.com/premiumsupport/knowledge-center/elb-redirect-http-to-https-using-alb/
If your services are separated servers:
Create target group for service A (target_A)
Create target group for service B (target_B)
Add servers to their groups.
Create balancer path rule "If Path is /A/* THEN Forward to target_A: 1 (100%)"
Create balancer path rule "If Path is /B/* THEN Forward to target_B: 1 (100%)"
I have a small problem with domain names and dns configs.
There are two domains: application12345.com domain and example.com.
I want to show my application on domain example.com.
I try to create an alias
example.com TO application12345.com.
I made
www.example.com 'CNAME' application12345.com
example.com 'Web alias' application12345.com
So example.com gets application12345.com index page.
If I click the link than content changes, but URN part is always the same.
Could you help me please? What should I do to show urn changes on example.com domain ?
P.S. Finally you can test it here:
http://cryptoflick.fr/
http://prod-env.uy7cvnaywj.eu-west-2.elasticbeanstalk.com/
My final solution which works
cryptoflick.fr web forward http://cryptoflick.fr
www.cryptoflick.com CNAME prod-env.uy7cvnaywj.eu-west-2.elasticbeanstalk.com
*.cryptoflick.com CNAME prod-env.uy7cvnaywj.eu-west-2.elasticbeanstalk.com
I often visit a link!
But i have no idea what dot (.) represents in the URL.
What is use of dot (.) in the URL?
The dot (.) is the character that was defined to be the delimiter in domain names (see DNS).
It delimits the labels in a domain name.
The domain name www.google.com consists of three labels:
com (aka. the top-level domain)
google (aka. the second-level domain)
www (aka. the third-level domain, or subdomain)
The '.' is like a character which differentiates from the domains. like www.todaysfuture.in the '.' after www means the first domain is done. then it checks the next domain.
The best example is like your email ID
first is the email-ID
then is the '#' that means the account name is done
then comes gmail/yahoo/wtvr
then a '.' to finish the account type
then '.' com or in depending on the account
Web addresses, or Uniform Resource Locators, go backwards with more specific terms coming first (like real addresses).
So for www.google.com
com is the top level domain - it might be a global domain like .com or a country code like .uk, and some top level domains have sub divisions like .gov.uk and .co.uk.
google is the domain - this is the name you actually buy and route to your servers/services
www subdomain - these are optional, and can be used to distinguish different services running on the same server, so www.google.com would serve web pages while ftp.google.com might be an FTP service.
Note that the subdomain is often optional - google.com and most other servers will assume www as the default service or infer it from the protocol (the http:// bit).
I have an application running in a tomcat behind a apache instance. Requests from the apache are proxied via mod_rewrite since this is possible to configure in a .htaccess and I do not have access to vhost-configuration (mod_jk is not even installed).
.htaccess looks like the following:
RewriteRule ^/?my-app/(.*)$ http://localhost:8080/my-app/$1 [P]
Thymeleaf nicely attaches the context-name to all URLs and generates relative ones like /my-app/relative/path (so without the http://hostname-part) thru-out the HTML, which work perfectly in this setup.
Unfortunately as soon as I use Spring MVC to redirect something...
#RequestMapping("/redirect-to-relative-path")
public String redirect() {
return "redirect:/relative/path";
}
...the users get redirected to http://localhost:8080/my-app/relative/path instead of just /my-app/relative/path, which will not work for outside users.
Also Spring Security redirects not-yet-authorized users to http://localhost:8080/my-app/login instead of just /my-app/login.
I know that I could just use a full URL to redirect to, but this should be dynamic.
What is the best (spring-boot-)way to make the framework redirect to relative URLs instead of attaching the hostname? (...basically like Thymeleaf is doing it)
The protocol standard says that Redirect URLs should (must?) be absolute.
Try setting proxyName and proxyPort in your Tomcat configuration:
<Connector port="8080" ... proxyName="www.mycompany.com" proxyPort="80"/>
These should be the public properties of the Apache instance.