HTTP request fails - http

I am trying to make an HTTP request from a micro-controller , the request is successful when I make it to google.com usign its IP (173.194.33.104) , while it fails when I use my server ip
when I put the ip address in the browser it show me a message like this
"Great Success ! Apache is working on your cPanel® and WHM™ Server" and some more info about apache server , I get my ip from the terminal (ping www.xxxxxx.com)
also if I put my ip with the user name in the browser I see my pages in my server (xx.xx.xx.xx/~aymanj/)
I want to make the HTTP request direct to my pages in the server
how can I do that ?

Lets assume you are using a browser (like IE, FireFox or Chrome) and that we aren't talking about using network functions from the Arduino. When you put an URL or some IP address in the browser's address control, and then hit enter - the browser parses that string to determine an address. Then based on your network settings, attempts to make a network connection to that address (typically over port 80). One it connects, the next step in the HTTP protococl is to request a single page from that connection. That page is everything after the address. If there is no page after the address specified, then its just the default "/" or default page. Each web server (Apache, IIS, etc) has options to set up different defaults. Typically that's something like index.html or default.aspx located in the root directory of whereever the web server lives. Extending that, a web server can map other directories to other paths. In your case, someone mapped a directory "/~aymanj" to your username. In that directory, there is probably a file something like "index.html". And when you go to that address without a directory or path, you are requesting the webserver root. Appparently no one has set a default page for it. Hope this helps you get started.

Related

Need to intercept & redirect http requests because IP for site is invisible from test machine yet the webserver is accessible from an internal address

I need to access a website we have from a machine that isn't able to see the external IP of the webserver. All http requests are of the form http://a.b.c.d/sitelauncher/sitelauncher.aspx and fail to see the site since that IP is inaccessible, yet the webserver happens to be on the local network. How can I somehow intercept and replace so all requests are of the form http://192.168.x.y/sitelauncher/sitellauncher.aspx
Silverlight is required on the client side in case this helps although have no access to source.
Is there some tool available that would permit some kind of string replacement on each occasion an http request is made?
Have tried a thing called rinetd which complains because it can't bind to the original IP target:port (no surprise since it'll be invisible).
Any ideas folks?
Cheers
Iain

IIS cannot access page through domain

I have successfully published a website(whatever.com) and it is accessible for global users except for the server itself.
If I input the domain(whatever.com) in the server's browser, it would display "This page can't be displayed."
How could I fix it that could let me access the page through the server's browser?
Other information:
Users from other computers could access my page.
Localhost(http://localhost/) works in the server's browser but domain(http://whatever.com/) doesn't.
Port 80 is opened.
Make sure that the domain "whatever.com" is in the bindings list on the website from IIS.
You might have a DNS problem on the server, you can manually map the "whaterver.com" domain in the hosts (C:\Windows\System32\drivers\etc\hosts) file of your server by appending the following line:
127.0.0.1 whatever.com

How to open a website by entering its name, not the IP address of the server

I have created a website and set it up on IIS on a Windows Server 2008 R2 which is on the local network. What should I do to be able to access that website by typing its name in the browser from client machine? Right now there're only two sites: One is the Default Website and the other one is my newly created one. If I type this IP in the browser of a remote computer, which has access to the server, the default website opens. If I add https:// to the ip address I get directed to my website. This means the website opened is decided upon the protocol (http or https). What if I add another website that would require SSL?
Actually the site you browse to is not decided by the protocol, it's decided by the port. By default HTTPS is port 443, and HTTP is port 80.
So if you have an HTTPS and HTTP protocol added to a website in IIS, you've created bindings for these two ports automatically.
This is visible by going into IIS clicking "Sites" from the "Connections" section in the left pane and then looking at the "Bindings" column in the center pane.
If you create another website on the host which uses SSL you would have to assign it to a different port.
To browse to that new SSL website you would have to enter the port when browsing to it.
e.g. https://serverName:444
(You don't have to enter default ports, 80 & 443, your browser automatically infers which to use from the protocol type and adds them if no other is present)
This is inconvient for users so people get around this by registering domain names such as stackoverflow.com and pointing them to the address with the port e.g. https://stackoverflow.com:444, so users don't have to enter port numbers.
Have you added the website address to the host file which sits in the drives folder of the system32. If you add the website name against the IP in the host file you should be able to access it using the name rather than than IP address
Something like this- 10.18.20.108 test.stackoverflow.com

IIS website inaccessible from server (but ok from outside)

On a server where an IIS website is hosted, if I open IE or Firefox and type the IIS website url, i got an error after a few seconds ("Cannot display the webpage", just like website would be offline). If I do the same from the exterior (as normal user do) everything works.
I have tried to give the IP address directly (thus skipping DNS), problem is the same. It only works if I type the internal ip address of the IIS website (eg : 10.0.0.x).
The reason I want to do that is that I need to access a specific page of the website in order to execute a scheduled task. I cannot use internal ip address to do that, because host name (HttpContext.Current.Request.Url.Host) is used inside ASP.NET code to switch between different configuration.
Here is my question : is it possible to access a specific page on a IIS website from server where website is hosted ? (using complete url, not internal ip address ?)
Yes - If I understand your question correctly you should be able to add a mapping in your local hosts file to point that domain at your IIS webserver.
e.g.
10.0.0.x my.example.hostname
(where x is obviously a number)
We use this configuation internally when developing multiple sites on our local machines - each site is bound to a specific hostname and all these hostnames have mappings in the 'hosts' file to 127.0.0.1
The same principal applies here, if I've understood the question correctly :)

Why is my fully qualified domain name request url getting converted to an ip address request url by the Cassini web server?

I have a web application which depends on the browser client retaining the FQDN in order for it to work, but what is happening is that in multiple browsers I am seeing the url get converted into an ip address url (containing the correct IP address) which is getting changed by a redirect from the web server.
The web server hosting the resource is Cassini, and the HttpRequest class Url property is returning the IP address in the URL instead of the FQDN.
Any suggestions on how to change this behavior?
This is probably a misconfiguration in your web server. In apache (for example), one can set the canonical host name to be used when doing certain rewrite procedures using the ServerName directive. One common one is when the web server adds slash to the end of your URL ("http://example.com/path" → "http://192.168.1.1/path/").
I recommend taking a peek at what's going on with curl.
This is not a DNS issue, it's a web server configuration issue.
Yes, the DNS is used to convert the hostname part of the URL into an IP address.
However that IP address will never appear in the browser bar unless the web server tells it to by sending a redirect.
Thanks to the helpful information provided, I was able to track down this issue to an incomplete implementation of the HttpWorkerRequest abstract class of the .NET Framework as part of the Cassini implementation. The Cassini implementation failed to override the GetServerName and the base implementation was returning the IP address instead of the domain name.

Resources