display domain instead of ip address as url - url

my website is www.somedomain.me, rented server from DigitalOcean, domian name is from Namecheap,
I redirected www.somedomain.me to http://104.236.xx.xx:6060/main/ ,
but when I open up www.somedomain.me it display the url as :
**http://104.236.114.32:6060/main/** or
**http://104.236.114.32:6060/main/resume.html** or
**http://104.236.114.32:6060/main/contact.html**,
how can i let it display as
**http://www.somedomain.me** or
**http://www.somedomain.me/resume.html** or
**http://www.somedomain.me/contact.html**
Thanks!

Lazy way?
Set up a URL Frame
Good way? The way the DNS gods intended?
If you have a dedicated IP, point it with an A record.
It's key to note A records can't specify a port. If at all possible, considering migrating your service to port 80? I understand sometimes this isn't possible but it'll make life a hell of a lot easier.
Edit: as for a redirect method, you could run a website on port 80 with like a line or two of HTML in an index.html to redirect to the proper port. Again assumes port 80 is unoccupied.

Previous post to clarify rewrite vs redirect
Michael makes a good point, however, in that if you want your customer to not have to include the port, you either have to do it for them via the redirect method you're using, or move your service to the default HTTP port 80. If you redirect the customer's browser to an IP address, that is what will be populated in the address bar and the Host header.

You might be able to do this thru Http Reverse Proxy. This wiki might guide you in the right track. You can use Heroku, Nginx, apache, etc. Though, apache might be overkill for the purpose.

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.

Route 53 - Special domain for a single page on existing server

I have a complex web app at example-app.com, hosting fully on AWS using ELB and Route 53 for DNS. It's a Rails app.
I'm running an experiment that I'm using in the rails app, at example-app.com/test. I want to set up new-domain-app.com, to point at example-app.com/test, and have the URL cloacked to always be new-domain-app.com. It's a single page site, so it shouldn't require any navigation.
I'm having a lot of trouble figuring out how to set up my DNS on Route 53 to accomplish this. Does anyone have good ideas on what this Route 53 configuration should look like?
AWS offers a very simple way to implement this -- with CloudFront. Forget about the fact that it's marketed as a CDN. It's also a reverse proxy that can prepend a fixed value onto the path, and send a different hostname to the back-end server than the one typed into the browser, which sounds like what you need.
Create a CloudFront web distribution.
Configure the new domain name as an alternate domain name for the distribution.
For the origin server, put your existing hostname.
For the origin path, put /test -- or whatever string you want prefixed onto the path sent by the browser.
Configure the cache behavior as needed -- enable forwarding of the query string or cookies if needed and any headers your app wants to see, but not Host.
Point your new domain name at CloudFront... But before you do that, note that your CloudFront distribution has a dxxxexample.cloudfront.net hostname. After the distribution finishes setting up (the "In Progress" status goes away, usually in 5 to 20 minutes) your site should be accessible at the cloudfront.net hostname.
How this works: When you type http://example.com into the browser, CloudFront will add the origin path onto the path the browser sends, so GET / HTTP/1.1 becomes GET /test/ HTTP/1.1. This configuration just prefixes every request's path with the string you specified as the origin path, and sends it on to the server. The browser address bar does not change, because this is not a redirect. The host header sent by the browser is replaced with the hostname of the origin server when the request is sent to the origin.
What you are trying to do is not possible. Route53 is a DNS system, and you can not configure a hostname (e.g. new-domain-app.com) to point to URL (e.g. http://example-app.com/test) using DNS.
However, you are probably using a wrong tool for the job. If example-app.com/test is indeed a simple, static, single page site, then you do not need to host it inside Rails app. Instead, you can host it on AWS S3 bucket, and then you can point new-domain-app.com to that bucket using Route53.
See the following for details:
http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/RoutingToS3Bucket.html
DNS knows about Domains, not url's. DNS simply converts names to IP addresses.
You can't do what you are asking for just using DNS and ELB, however, what you can do is have a seperate VHOST for new-domain-app.com that points to your example-app.com site and accomplishes what you want using some sort of redirection rule that only fires for new-domain-app.com.
I'm not sure that this qualifies as an SO question, and more likely is a serverfault question. Specifics about your webserver and OS platform would be helpful in getting more specific advice.
So here's some details:
You already have example-app.com setup and working
You create a CNAME entry pointing new-domain-app.com to example-app.com or you can make an A record pointing to the same IP. If you already have example-app.com pointing to a different IP address, then use a subdomain (test.example-app.com) to isolate it.
Setup a new vhost on your server that basically duplicates the existing vhost for new-domain-app.com. The only thing you need to change is the server name configuration.
Why does this work? Because HTTP 1.1 included the HOST header that browsers send along, and web servers use in vhosting to determine which virtual host to route an incoming request to. When it sees that the client browser wanted "example-app.com" it routes the request to the appropriate vhost.
Rather than having to do some fancy proxying, which certainly can be used to get to a similar result, you can just add a redirection rule that looks for requests for the host example-app.com and redirects those to example-app.com. In apache that uses mod_rewrite which people often utilize by putting rules in the ubiquitous .htacess file, but can also be done in nginx and other common web servers. The specifics are slightly different for each.

How to set up my xampp so that when i type my ip to get my custom made site

What i want to do is to set xampp so that when i give my ip to someone they can access my site. The reason for me to find something like this is cause i want to embed paypal testing to my site and it is needed to set a URL for the customers to return to my site when they complete their transactions... I run XAMPP 1.7.7 and my modem is a siemens. Also is there any free way to get a url ie blahblahblah.net or something like this?
In order to do this you will need to set up port forwarding on your router to your web server on your machine (you will have to look at your Siemens router documentation on how to do this). You will only be able to do use a custom URL if your router suports dynamic DNS, which most modern routers do. This required because probably the way you access the Internet your IP address can change each time you log in. If this is the case, you can get one free domain for this purpose at DynDNS.

DNS File Mapping

I'm trying to work out a feature for a Web application, but I'm a bit confused at this point. I was wondering if anyone can shed some light on the following scenario.
Say, my Web app is located at domain1.com and a users website is located at domain2.com. What I would like to allow is for the user to be able to map their domain to one of the files/pages on my server. So if someone accesses domain2.com/files then it will internally and transparently route to domain1.com/files.aspx?domain=2 (notice the domain parameter).
I know this can be done with a simple file redirection (301 or 302) on the users server, but I would like to achieve this on the DNS level. How can I go about it?
Thanks in advance!
You can map domain2.com (or a subdomain) to the same IP domain1.com runs on using the A record. That's about everything you can achieve on DNS level, as it doesn't care about directory structures.
Simply put, you can't. If you wanted to point foo.domain1.com to the record for foo.domain2.com, then you can probably use a CNAME record but DNS has no clue about HTTP URLs.
The "HTTP Redirector" plug-in for Simple DNS Plus does just that if you configure it to redirect to "http://domain1.com/files.aspx?domain=#HOST#"
Technically it actually does a HTTP redirect (native DNS is not possible), but it is done at the DNS servers instead of the web-server.
See http://www.simpledns.com/kb.aspx?kbid=1258

Rails/Passenger/Apache: Simple one-off URL redirect to catch stale DNS after server move

One of my rails apps (using passenger and apache) is changing server hosts. I've got the app running on both servers (the new one in testing) and the DNS TTL to 5 minutes. I've been told (and experienced something like this myself) by a colleague that sometimes DNS resolvers slightly ignore the TTL and may have the old IP cached for some time after I update DNS to the new server.
So, after I've thrown the switch on DNS, what I'd like to do is hack the old server to issue a forced redirect to the IP address of the new server for all visitors. Obviously I can do a number of redirects (301, 302) in either Apache or the app itself. I'd like to avoid the app method since I don't want to do a checkin and deploy of code just for this one instance so I was thinking a basic http url redirect would work. Buuttt, there are SEO implications should google visit the old site etc. etc.
How best to achieve the re-direct whilst maintaining search engine niceness?
I guess the question is - where would you redirect to? If you are redirecting to the domain name, the browser (or bot) would just get the same old IP address and end up in a redirect loop.
If you redirect to an IP address.. well, that's not going to look very user friendly in someone's browser.
Personally, I wouldn't do anything. There may be some short period where bots get errors trying to access your site, but it should all work itself out in a couple days without any "SEO damage"
One solution might be to use Mod_Proxy instead of a rewrite to proxy traffic to the new host. This way you shouldn't see any "SEO damage".
I used rinetd to redirect the IP traffic from the old server to the new one on IP level. No web server or virtual hosts config needed. Runs very smoothly and absolutely transparent to any client.

Resources