Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I edited /etc/hosts file and entered below information :

127.0.0.1    test.com  //working

127.0.0.1    https://test.com //not working . 

from the above info, http://test.com is redirecting to 127.0.0.1, but https://test.com is not redirecting to 127.0.0.1 . Is there any way I can do that?

share|improve this question

migrated from stackoverflow.com Aug 2 '12 at 13:59

This question came from our site for professional and enthusiast programmers.

    
I've got the same issue. Have you solved? –  sensorario Aug 17 '13 at 6:02

2 Answers 2

/etc/hosts does not care about protocols, it handles host names. Moreover, // is not a comment character in /etc/hosts. See

man hosts

for details.

127.0.0.1 test.com

should be enough for redirecting both http and https. Do you run a service listening for https connections on your localhost?

share|improve this answer
    
leave those commnents, i just entered them here . My use case is,in my website some parts of the code can be tested only with the domain name, and my website uses https . So, if it is just http, i can test locally with the domain name . But as it is https, I am unable to test locally . –  user1506361 Aug 2 '12 at 13:43
3  
Once more: Is your local webserver configured to handle https requests? –  choroba Aug 2 '12 at 13:48

I thought I was having a similar problem.

For anyone who makes the same silly mistake I did...

I was testing a new webserver by rerouting the requests to a different IP by /etc/hosts.

I did tail -f access_log on my web server and saw all my test requests, except the https ones. I spent a few minutes trying to figure that out.

Finally, I realized that I log SSL requests to a different file. Those log entries were working just fine, in access_ssl_log. Doh!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.