My website shows hostname url instead of domain name url - url

i have hosted my website in openshift cloud platform and i have got my domain from godaddy domain seller, after i have hosted my application, my domain name redirects to my hosting url
let us say i have domain name as
www.yellowbox.com
and i have my cloud hosted url as
yellowbox-boxsoft.rhcloud.com
godaddy.com redirects to my cloud host when i hit www.yellowbox.com , but i see problems where i have href links which show my cloud url
yellowbox-boxsoft.rhcloud.com/addUser.html
and this really bothers me, i would like to have my domain url instead of hosting url as below
www.yellowbox.com/addUser.html
i am new to cloud hosting and domain related topic, need some direction

There are a couple of things that could be going on:
1.) You could be using domain masking at godaddy and not have things setup correctly for openshift. Basically it is loading your open shift gear in a somewhat of an iframe on the page, so as far as your open shift page is concerned, it is still being visited at your app-domain.rhcloud.com address
2.) you are generating your links as FQDN links instead of relative links, and using your application url in them. use relative links instead (like /addUser.html)
You should be setting up your www.example.com as a cname record that points to your app-domain.rhcloud.com address, and then things should work just fine.

Related

Was this site hacked? URL redirects when "www" removed.

I'm trying to figure out whether a website I use was hacked.
When I access the site via www.site-name.com, I'm taken to the website.
However, when I access the site without the "www," i.e. site-name.com, I'm taken to a different website.
Why is this happening? I did a little research and my only guess is that someone changed the site's .htaccess file, but that seems unlikely, as the different website has no relation to the official site.
Can someone help me understand what's going on here?
One IP address can host multiple websites with different hostnames using Virtual Name Hosting.
The HTTP server will look at the Host header in the request to determine what site to use for a given request.
This lets you have one IP address serving example.com and example.net.
Typically, the first Virtual Name Host will be the default, so if you were to ask for example.org the server would not recognise it and give you example.com instead.
In this case, it appears that the server has a Virtual Name Host configured for www.site-name.com but not for site-name.com so requests for site-name.com get the default site for the server.

How do custom domains work with routing, links, and redirects in a Saas app?

I understand that if I want customers to be able to use a custom domain that points to their space at customer.mysaasapp.com, they must define a CNAME record that aliases the canonical customer.mysaasapp.com domain.
What I don't understand is how this alias persists across requests. For example, if the customer site links to its resources, how does it know whether to link to the customer.mysaasapp.com/videos domain vs the customclientdomain.com/videos resource? I don't want the true subdomain to show up in the navigation bar as soon as a link is clicked. How is this handled?
Let me try to explain it for you. As you already know CNAME are canonical names for another domain.
As you know when we hit a domain in browser address bar. Browser asks the DNS (domain name server) where to send the request. DNS matches the domain name and sends the IP address back to browser and browser hit those IP address to get the response.
But when we want multiple sites to be served from same IP address which is the case in SAAS app. We can define CNAME for each client. Which is alternative to IP mapping.
So when browser asks the DNS about the address for the provided host url. DNS sends back the actual domain name/path and tell's the browser that it's the right address to ask.
So now browser sends the request to actual domain behind the scene and sets the HOST header to the provided address which user entered. (customclientdomain.com/videos for your case).
Now the server knows which host was provided by the user and responds accordingly.
From next request onward Browser does the magic and give you a mimic that it's a totally new website.
All of the modern browser including WGET , CURL also handles this.
Here is a link with more details.

What is elastic IP on Amazon EC2? is it okay if I don't use it?

I have hosted a RoR app on Amazon EC2 instance. Instance has public IP but no elastic IP is assigned. Application is pointed to a domain using Dreamhost.
We use Amazon S3 to store audio files uploaded through web application and load these files back to site and play in player.
This is where I am facing weird issue, sometimes files play fine but sometimes it gives error saying
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin http://XX.XXX.XX.XXX is therefore not allowed access.
But at the same time if I copy paste S3 url in browser outside my application it loads.
Why error gives IP address instead of saying mydoamin.com is therefore not allowed access?
I am guessing the issue is because of some domain/IP configurations.
An elastic IP on amazon is an IP which is reserved to you. Without it, every time you stop and start your instance, a different IP will be set to it.
You don't have to use elastic IP, you could, for example point your domain to an ELB (elastic load balancer) CNAME, which will remain constant as it load balances between one or more instances of your application.
I'm not sure this has anything to do with the error given, which is explained in this answer:
Site B uses Access-Control-Allow-Origin to tell the browser that the
content of this page is accessible to certain domains. By default,
site B's pages are not accessible to any other domain; using the ACAO
header opens a door for cross-domain access by specific domains.
Site B should serve its pages with
Access-Control-Allow-Origin: http://sitea.com
It seems that the problematic link is an absolute path with the explicit IP, I have no idea why this should happen, look at the source of the page from which the link fails, and try to figure it out.

CNAME url on site transfered to

Is it possible to have the site you transfer to from a CNAME and 'A' record keep the name from the CNAME in the url? Example: Site 123.com has a CNAME called app pointing to abc.com. When I type in app.123.com, it transfers me to abc.com and keeps app.123.com in the url on the first page that I transfer to. But once I click anything on the page to move around within the page, the url reverts back to abc.com. Is it possible to have the app.123.com stay in the url while I move around. So instead of changing to abc.com/otherPage.php, it would stay app.123.com/otherPage.php?
Thanks for any help!
There are two different mechanisms at work here, DNS and HTTP.
When you use a URL containing app.123.com, that's looked up using DNS and gives the IP address that happens to be the same as the IP address configured for abc.com
But once you're viewing that page, the HTML of that page will determine how the links work, they may be absolute URLs including abc.com or they may be relative URLs, so behaviour could vary.
A site can be made to work under multiple aliases but it would need to use the request headers to detect the address used by the client and alter content accordingly.

using \\servername\sharename in IE9 not being picked up as intranet site

I have a very basic intranet site for our company, and it's main purpose is to link to SMB shares on our network, so people can open files and edit them, without the need to then reupload to the site.
What I have, is a basic < a href="\IP ADDRESS\SHARENAME\">< /a>
The issue seems to be, regardless of whether I use the IP address, or the actual DNS name of the machine, IE9 always seems to think the intranet is an internet site, and stops these links from working.
Let's say for example, the web server address is 10.1.3.81, and I have a share on that same server for a global phone directory spreadsheet. I want someone to be able to click on the link on the page, and have it open that file directly.
So for the href, I put in \\10.1.3.81\intranet\phone directory\list.xls
Or something like that. IE9 (which is what all our users are using), considers this link to point to file://10.1.3.81/intranet/phone directory/list.xls
That's great, but as it doesnt consider this to be on the intranet, it blocks the file:// protocol, and the link does nothing.
If I add the site to my trusted sites list, it then works correctly. So I am wondering if there is a way on the programming side of things, that will let me create these kind of links and have them auto picked up as an intranet link?
Failing that, I will post on serverfault, and see if someone can guide me on applying a policy to add this site to trusted sites for all users and computers.
Many thanks
Eds
As it turns out, I was accessing the intranet by using either the FQDN or the IP address of the server.
As this article shows, http://support.microsoft.com/kb/303650 , if I just use the server name instead, and drop the domain name from the end, the links behave as I would like.
Sorry for this useless question.
Thanks, Eds

Resources