I'm writing as I've encountered an issue that doesn't seem to get resolved, would value the community's help.
I'm trying to push an image to a local registry I deployed on port 5000.
When I use this command docker push localhost:5000/explorecalifornia.com to push the image to my local registry, I get the following message
Get "http://localhost:5000/v2/": net/http: request canceled (Client.Timeout exceeded while awaiting headers)
I've confirmed the registry is on port 5000 by using GET on postman, and I get a valid, expected {} response (since there's no images currently on my local registry).
I've since tried to fix this by updating my etc/hosts file to comment out "::1 localhost" per advise of this post. This is the contents of my etc/hosts file
##
# 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
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
I also updated my etc/resolve.conf file with the following nameservers per advise from this post.
nameserver 10.0.2.3
nameserver 8.8.8.8
nameserver 8.8.4.4
None of this worked. Did anyone also encounter this issue? Is there any recommendations to help fix this issue?
Here's the source code if it helps! Thank you in advance :)
You may have a HTTP proxy defined. Please try running these commands.
unset http_proxy
unset https_proxy
I think there must be sth changed with the kind image. I use the script from this page:
https://kind.sigs.k8s.io/docs/user/local-registry/
I am able to create a new kind cluster and registry. After that, I have no problem following the video lecture to push the explorecalifornia.com image to the local registry.
I use a work-around for this error and it is as below:
Firstly, tag the images using the localhost ip instead, ie
docker tag imagename 127.0.0.1:5000/imagename
and,
docker push 127.0.0.1:5000/imagename
I hope this works for you as well.
Is there any issues to modifying the CNAME for cdn.abc.com to point to cloudfront.abc.com instead of the Cloudflare domain?
Is there way to altering the hosts file to test in windows environment .
Run a dig command on the hostname you want to test against and add the resulting IP address in your hosts file with the public hostname.
I'm trying to set up my local web development environment to map all .test domains to 192.168.10.10 IP. The problem is that I find all the tutorials extremely confusing.
Here's what I did already:
I installed dnsmasq using Homebrew with brew install dnsmasq command.
I put address=/.test/192.168.10.10 to /usr/local/etc/dnsmasq.conf.
I'm not sure what to do with the resolver. I have an /etc/resolv.conf file containing nameserver 172.20.10.1 (I don't know where it comes from) and then some tutorials say to create /etc/resolver/test file and putting nameserver 127.0.0.1 there.
Here's where I'm lost. First of all, which resolver should I use? The resolv.conf file or /etc/resolver/test? If that's the latter one, should I edit out the resolv.conf? And also, should I put nameserver 127.0.0.1 or nameserver 192.168.10.10? I don't understand if that's supposed to be the IP of my local machine (127.0.0.1) or my web dev machine (192.168.10.10).
Please help me to understand it better.
After installing TeamViewer, I have changed the wampserver port to 8080, so the address is http://localhost:8080.
For the host file located at C:\WINDOWS\system32\drivers\etc\, I have also made the change as below
BEFORE
127.0.0.1 www.example.com
AFTER
127.0.0.1:8080 www.example.com
When I access www.example.com, it doesn't redirect to my wampserver, how can I fix it?
I managed to achieve this by using Windows included Networking tool netsh.
As Mat points out : The hosts file is for host name resolution only, so a combination of the two did the trick for me.
Example
Overview
example.app:80
| <--Link by Hosts File
+--> 127.65.43.21:80
| <--Link by netsh Utility
+--> localhost:8081
Actions
Started my server on localhost:8081
Added my "local DNS" in the hosts file as a new line
127.65.43.21 example.app
Any free address in the network 127.0.0.0/8 (127.x.x.x) can be used.
Note: I am assuming 127.65.43.21:80 is not occupied by another service.
You can check with netstat -a -n -p TCP | grep "LISTENING"
added the following network configuration with netsh command utility
netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.65.43.21 connectport=8081 connectaddress=127.0.0.1
I can now access the server at http://example.app
Notes:
- These commands/file modifications need to be executed with Admin rights
- netsh portproxy needs ipv6 libraries even only to use v4tov4, typically they will also be included by default, otherwise install them using the following command: netsh interface ipv6 install
You can see the entry you have added with the command:
netsh interface portproxy show v4tov4
You can remove the entry with the following command:
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=127.65.43.21
Links to Resources:
Using Netsh
Netsh commands for Interface IP
Netsh commands for Interface Portproxy
Windows Port Forwarding Example
The hosts file is for host name resolution only (on Windows as well as on Unix-like systems). You cannot put port numbers in there, and there is no way to do what you want with generic OS-level configuration - the browser is what selects the port to choose.
So use bookmarks or something like that.
(Some firewall/routing software might allow outbound port redirection, but that doesn't really sound like an appealing option for this.)
What you want can be achieved by modifying the hosts file through Fiddler 2 application.
Follow these steps:
Install Fiddler2
Navigate to Fiddler2 menu:- Tools > HOSTS.. (Click to select)
Add a line like this:-
localhost:8080 www.mydomainname.com
Save the file & then checkout www.mydomainname.com in browser.
Fiddler2 -> Rules -> Custom Rules
then find function OnBeforeRequest on put in the next script at the end:
if (oSession.HostnameIs("mysite.com")){
oSession.host="localhost:39901";
oSession.hostname="mysite.com";
}
The simplest way is using Ergo as your reverse proxy:
https://github.com/cristianoliveira/ergo
You set your services and its IP:PORT and ergo routes it for you :).
You can achieve the same using nginx or apache but you will need to configure them.
This doesn't give the requested result exactly, however, for what I was doing, I was not fussed with adding the port into the URL within a browser.
I added the domain name to the hosts file
127.0.0.1 example.com
Ran my HTTP server from the domain name on port 8080
php -S example.com:8080
Then accessed the website through port 8080
http://example.com:8080
Just wanted to share in case anyone else is in a similar situation.
If what is happening is that you have another server running on localhost and you want to give this new server a different local hostname like
http://teamviewer/
I think that what you are actually looking for is Virtual Hosts functionality. I use Apache so I do not know how other web daemons support this. Maybe it is called Alias. Here is the Apache documentation:
Apache Virtual Hosts examples
-You can use any free address in the network 127.0.0.0/8 , in my case needed this for python flask and this is what I have done :
add this line in the hosts file (you can find it is windows under : C:\Windows\System32\drivers\etc ) :
127.0.0.5 flask.dev
Make sure the port is the default port "80" in my case this is what in the python flask: app.run("127.0.0.5","80")
now run your code and browse flask.dev
Using netsh with connectaddress=127.0.0.1 did not work for me.
Despite looking everywhere on the internet I could not find the solution which solved this for me, which was to use connectaddress=127.x.x.x (i.e. any 127. ipv4 address, just not 127.0.0.1) as this appears to link back to localhost just the same but without the restriction, so that the loopback works in netsh.
You need NGNIX or Apache HTTP server as a proxy server for forwarding http requests to appropriate application -> which listens particular port (or do it with CNAME which provides Hosting company). It is most powerful solution and this is just a really easy way to keep adding new subdomains, or to add new domains automatically when DNS records are pointed at the server.
Apache era call it Virtual host ->
httpd.apache.org/docs/trunk/vhosts/examples.html
NGINX -> Server Block
https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
Alternate way
Install Redirector
Click Edit redirects -> Create New Redirect
How can i run local tests ( with mamp ) that have urls of this kind : www.example.com instead of http://localhost:8888/install.folder
Thank you
If your tests are truely local, you may simply add an alias in your hosts file (/etc/hosts on linux). This alias will cause your computer to resolve www.example.com as 127.0.0.1 (localhost).
If you wish to use this outside of your computer, you will need to purchase a domain, and set its DNS up to forward to your IP address (and open the appropriate port in your router to forward to your computer).
If you don't want to have to include the port number (':8888'), change the port that your server is being hosted on to the default (80). This may be done through the server's configuration file by changing the 'Listen' directive.
If you do not want to have to add the '/drupal' path, add an 'Alias' directive to redirect the user from the root path ('/') to '/drupal'. You may also change the 'DocumentRoot' to drupal.
You will need to add an entry to your hosts file like this:
127.0.0.1 www.example.com
Note: this will not keep you from having to enter the port number or directory - it will only allow you to use a host alias for the host name itself.