host entry in android - android-emulator

what is the procedure to put an host Entry in android host file?
we did the followings.
An Entry for the URL was made in hosts file of the Android using cmd ( File Explorer -> System -> etc ->hosts ).
127.0.0.1 localhost
xx.xx.xx.xx www.example.com
For Reference please visit
http://www.bradcurtis.com/2011/02/13/hosts-file-google-android-emulator/
But When we execute the program, the host entry is not read by android. It is going for DNS to get the ip for which we have already made an entry in hosts file.
Can anyone suggest how to add an entry in hosts file of Android so that the entry can be read while the program is executed.

Related

How to start wiremock standalone with custom hostname?

For example, I want to start wiremock standalone with hostname "my.abc.com" with port 9999. Where can I config that? Or what is the right command line options for hostname?
Thanks a lot in advance.
The hostname is determined by DNS or your host file, rather than WireMock itself.
If you want to run everything locally but with a hostname other than localhost you can edit your hosts file and add a line like:
127.0.0.1 api.mydomain.com
Then you can hit a locally running WireMock server on e.g. http://api.mydomain.com:9999/
As agoff points out, if you want to use the Java DSL against the instance you need to configure it:
WireMock.configureFor("api.mydomain.com", 9999);
The host file can be found in the following places:
Windows - c:\Windows\System32\Drivers\etc\hosts
Mac - /private/etc/hosts
*nix - /etc/hosts

IBM Cloud Code Engine revision fails when deploying standard container with port 80

I am trying to deploy an app in a Code Engine project. The container image is pretty standard: docker.io/library/httpd. All I did in the configuration wizard is to change the port from Code Engine default 8080 to port 80.
Code Engine comes back with:
Revision failed to start with "exit code 1". Check your image and configuration.
In the logs I found these two lines:
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
Why?
I don't know the answer to your question "why", except I see some people on Stackoverflow mention the range up to 1024 is reserved by the OS. I could run my httpd locally on port 80, but in the IBM Code Engine I had to change to 8080.
This is how I managed to get it running:
I edited the httpd.conf as this post implies:
"There is a hint on how to do this at the DockerHub page. An alternative config file must be obtained and added to the container via the Dockerfile.
First get a copy of the config file:
docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf > my-httpd.conf
Then edit the my-httpd.conf file and modify the port:
Listen 8080
Finally add to the Dockerfile the instruction to copy it:
COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf "

Yarn: Error: connect ECONNREFUSED 127.0.0.1:443

When I install ELM via yarn, I get
-- ERROR -----------------------------------------------------------------------
Something went wrong while fetching the following URL:
https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz
It is saying:
Error: connect ECONNREFUSED 127.0.0.1:443
NOTE: You can avoid npm entirely by downloading directly from:
https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz
When I manually browse to https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz. I get
However other people can access the link and it downloads the file.
EDIT:
HOSTS File:
127.0.0.1 view-localhost # view localhost server
127.0.0.1 mydevsnapcap.com www.mydevsnapcap.com app.mydevsnapcap.com internal.mydevsnapcap.com
0.0.0.1 mssplus.mcafee.com
Edit
This use to work a few days ago.
More tests:
I cannot access it from my phone and pc using my fibre connection, but I can access it on both my phone and mobile using my mobile connection.
It turns out that it was my ISP that was for some reason blocking the link. I switch to using the google dns and all is good in the hood: https://developers.google.com/speed/public-dns/docs/using
Something in your computer or on your network is resolving the domain github.com to 127.0.0.1, i.e. localhost. Hence, everytime you attempt this access, it tries to reach a service running on the very same computer you're making the request from.
Check your DNS settings.
Check that there are no entries for github.com in the hosts file (on Windows C:\Windows\System32\drivers\etc\hosts, everywhere else /etc/hosts).
If you're running something like Pi-Hole on your network, check, that it doesn't catch github.com

How to point an IP address to domain name

I have an IP address of a server (http://185.207.xxx.xxx/test2.php) and I want to open this as (http://domainname.com/test2.php) from my system.
when i edited my hosts file in /etc/hosts with following entry
185.207.xxx.xxx domainname.com
but it is showing below error:
Error: The requested URL can not be retrieved
Can anyone help me in resolving this?
Try this ,
185.207.xxx.xxx domainname
Not need to add .com
and the hosts file must be edited as the Administrator or root user. In Windows, remember to open your text editor as the Administrator user.

Using "http://localhost" instead of "http://xx.xx.xx.xx" on iPod on WAMP

I am running Windows 7 and use my iPod Touch to access my localhost sites for testing purposes on WAMP.
I can browse my localhost sites by navigating to my machine IP in Safari on my iPod like so: http://10.0.0.100
I would like to know if it is at all possible to use http://localhost instead, and how I can accomplish that.
Thank you very much!!
Basically, localhost refers to 127.0.0.1 refers to the loop back ip which is the ipod itself so it's not possible unless you change [localhost to resolve to machine IP which is in this case 10.0.0.100] in the (DNS / hosts file) your ipod is using to resolve domain names in your connection settings and I don't recommend that.
Following are the steps needed to change the hosts file in your ipod (I warned you already this is not a good thing unless you know what are you doing)
source: https://discussions.apple.com/thread/2801892?start=0&tstart=0
Simple solution:
the hostfile is located at: /etc/hosts
To edit this file you need to SSH into your device, If you know how to do this directly just use vi, or nano to edit the file. From windows use WinSCP to access the file system via FTP(SSH). Then simply navigate to /etc/hosts download the file to your desktop, right click and open it with note pad, add your resolver to the last line "192.168.0.100 testserver", save, and replace the original file with the new one.
/etc/host -- example config
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.0.100 testserver
*To SSH into an ipod it must have OpenSSH installed, usually this requires a jailbreak.