Why does HTTPS break my hosts file redirection? - https

There is a machine (let's call it Machine) with a hostname in my local network. If I go to abc.def.com, my DNS service resolves Machine's external IP and connects me successfully with https://. I've added a hosts file entry so that local.abc.def.com resolves to Machine's local, internal IP.
However, using https://local.abc.def.com breaks everything. I get ERR_CONNECTION_REFUSED in Chrome and This page can't be displayed in Internet Explorer. If I replace https:// with http://, it works again. What's going on?

I assume, for your abc.def.com machine you have https redirect configured with 443 port as well.
Based on description above your application/web server you are using
is not listening port 443 or there is a firewall rejecting your connection.

Related

Charles debugging proxy not connecting to localhost

Charles Web Debugging Proxy not connecting to localhost. It was working right after I installed, but all of a sudden get connection refused, when trying to connect to localhost. Other traffic is going through proxy ok. The web server and proxy ports are different. *.8888 proxy listening on all addresses.
Get the following error
Charles Error Report
Failed to connect to remote host
Charles failed to connect to the remote host. Check that your Internet
connection is ok and that the remote host is accessible. Maybe your
network uses a proxy server to access the Internet? You can configure
Charles to use an external proxy server in the External Proxy
Settings.
The actual exception reported was:
java.net.ConnectException: Connection refused Charles Proxy,
http://www.charlesproxy.com/
Did you use PHP Built-in server?
The FAQs of office document say:
Localhost traffic doesn't appear in Charles
Some systems are hard coded to not use proxies for localhost traffic, so when you connect to http://localhost/ it doesn't show up in Charles.
The workaround is to connect to http://localhost.charlesproxy.com/ instead. This points to the IP address 127.0.0.1, so it should work identically to localhost, but with the advantage that it will go through Charles. This will work whether or not Charles is running or you're using Charles. If you use a different port, such as 8080, just add that as you usually would, e.g. localhost.charlesproxy.com:8080.
You can also put anything in front of that domain, e.g. myapp.localhost.charlesproxy.com, which will also always resolve to 127.0.0.1.
Alternatively you can try adding a '.' after localhost, or replace localhost with the name of your machine, or use your local link IP address (eg. 192.168.1.2).
If Charles is running and you're using Charles as your proxy, you can also use local.charles as an alternative for localhost. Note that this only works when you're using Charles as your proxy, so the above approaches are preferred, unless you specifically want requests to fail if not using Charles.
If you use php built-in server use
php -S 127.0.0.1:8080 -t ./public
instead of
php -S localhost:8080 -t ./public

Hosting Website to local in IIS

I am able to host website in IIS 8 but not with ip add. The binding with ip and browsing the site in chrome gives 'ERR_NETWORK_ACCESS_DENIED'
http://localhost - works
http://10.111.148.133/ - does not work.
Seems you are using your public IP.
You can browse using your local IP address. Your local IP address should be some thing like 192.168.xxx.xxx .
You can check your local Ip address using the following command in command prompt.
ipconfig/all
if you want to access your site using public ip, then you need to port forward from your public IP to localIp by setting the DMZ Host in your router.
Along with the above answer, try going through your Firewall settings on the host computer and enabling anything related to IIS or port 80.
You can easily figure out if your antivirus or firewall is the issue by temporarily disabling it.
However, I think your issue is that you grabbed your public IP address, off whatsmyip.com or something, you just need to exec ipconfig to see what your local IP is.

IIS https website can't enter

Update 4/12:
I'm using Vigor 2910 (router) to connect to my server. I found out that I cloud view the website correctly by external ip from other PC. But everytime I try to login the browser redirects me to internal ip. Is there any settings I should know besides port forwarding 80 and 443 from external ip to internal ip?
I found a way to fix the problem.
My problem is, when I use another PC connected to different router trying to connect to the PHP site with external IP, it always redirect me to internal IP address.
For example:
Entering site https://140.XXX.XX.XXX
After clicking any objects on the site, then I was redirect to https://192.XXX.X.XXX
Cause I'm connected to the router that I didn't notice it not only affects my PC but also in PHP config.php. In config.php, the redirecting address is written in internal IP instead of external IP.
Just simply change the IP to external IP, then it works.

Enabling https on server for one site but not another

I have run into an issue when enabling https on a server that hosts many sites. I have only enabled https for one site (site1.com), but when a user tries to browse to site2.com which doesn't have https enabled, if they try to get to https://www.site2.com, it redirects to https://www.site1.com. Can I prevent this from happening?
You will need two IPs for that and host one site with a different IP.
The 'problem' is that SSL connection is established on IP basis through TCP before the HTTP Server gets the Request, which is then already encrypted. Since your SSL port is linked to site1 this site will be served.
If your DNS A-Records point to the same IP then the only way i see you could do this is either use two IPs or enter the URL of site2 with http://site2.com (explicitly without HTTPS). In that case the connection would be opened unencrypted on Port 80.
Setup two IPs use HTTPS for one and not the other.

Do we have to buy a domain to serve Bugzilla?

I tried putting my IP from whatismyip.com in the urlbase of Bugzilla but it did not work. I wasn't able to create a new account for my team mate, and he wasnt able to access the server by typing the my ip address in his browse. And surely, when I connect again, my IP address will change. Do we have to buy a www address to host Bugzilla?
You can setup a dynamic dns service, for example via http://www.dyndns.com or http://www.no-ip.com or http://freedns.afraid.org to solve the changing ip problem without buying a domain (or buying a domain as well, but it's not a requirement).
But the real problem is that your team mate cannot access the server via the current IP address which points to either a misconfiguration of the webserver (listening only on localhost?), to a firewall in between, or most likely, that port forwarding isn't set up in your router for requests coming to your external IP address to be forwarded to the machine where you have Bugzilla set up. Additionally, you must set the urlbase to your local IP address, not to the external IP address, as blak3r says.
Check http://www.portforward.com for instructions on how to do port forwarding. But don't forget that everything mentioned has to be working:
Web server listening to outside requests: This can be tested from the same internal network via the local network IP address (what you see typing in a command line console ipconfig in Windows and ifconfig in Linux). If you can connect from a different machine on the same network via the local IP address, this is solved.
Firewalls (in router and the webserver machine) accepting connections to the web server port: For firewalls in the web server, the same test as above covers it.
Port forwarding so the router forwards the requests received on the web server port to the web server machine: This gets tested in the same way as firewalls in the router, that is, you must have your friend (or yourself from the house of your friend) try to connect to the dyn dns name set up or to the external IP as reported by whatsmyip.org.
This is all assuming your test mate is not on your same network, if he is, just using the local IP address (shown via ipconfig or ifconfig) instead of the external IP address and making sure the first step is covered (web server listening to outside requests) should be enough and nothing else is needed!
You most likely do not have your port 80 forwarded to your machine which is the reason he cannot connect when using the IP that was returned from whatismyip.com.
Assuming you're on a windows box... do
Start->Run->cmd then type
ipconfig
If your address starts with 192...* or 10...* this is your Local Area Network (LAN) IP. If this is the case, then your isp provided you with a router. Look for a setting called port forwarding or "application setting" which allows you to forward all incoming traffic on your router to a particular IP address. Go into your router's configuration settings and make sure port 80 (and maybe 443 if you're using ssl are forwarded to your local ip).
The other problem you mentioned is you do not have a static IP. This is a common problem and no you do not need to buy an address. There are several sites which can provide you a free dynamic dns host. Try no-ip.org.

Resources