Re-mapping localhost in Windows on Parallels for Mac - parallels

I have just started using Parallels for Mac, and am attempting to debug a locally running web application on my host MacOS machine.
I have figured out that I can connect to the my host via 10.211.55.2 in the browser in my virtual windows machine.
What I'd like to do is to instead connect via localhost and have this routed through to the 10.211.55.2 ip instead.
I tried editing my windows hosts file with an 10.211.55.2 localhost entry but this made no difference.
Is this possible to do?

localhost is hardcoded in many libraries. In theory it should be possible, but it would break a lot of things, including not being able to boot up the system. Connections to localhost are used frequently for interprocess communication throughout the system, so there's more to it then you using it for testing websites. Just go with another name.

Related

Network configuration between nginx server (running on WSL) and Beeware app (Build and run from windows anaconda)

my web server is on wsl, and beeware is on anaconda (windows version not linux), how do I configure beeware app to communicate with wsl server.
is there a feasible way?
current I'm using ngrok host as a gateway.
Is there any alternate way that doesn't require data packet to travel outside my system
Is there any guide to develop a local system?
I'm going to attempt to answer this generically since I don't currently use Beeware/Anaconda. I tried skimming the Beeware docs, but too much of it (including the "publish", which might be a key element in the nginx integration) is "Coming soon".
Assuming there are no virtual machines or containers in the mix, Windows should detect ports on the WSL2 instance and map them correctly to localhost. For instance, if in WSL you python3 -m http.server 3000, then you should be able to open that page in a Windows web browser at http://localhost:3000. So, by default, Anaconda on Windows should be able to access your web server in WSL through localhost. If this isn't happening:
First, make sure that nginx is listening on 0.0.0.0
Sometimes the Windows localhost auto-mapping seems to break. See this answer for some additional ideas. A quick-fix is often to just do a wsl --shutdown to reset the interfaces. A longer-term fix might be to disable Windows Fast Startup.
On the flip side, if there is any connection from nginx that needs to be made to Beeware/Anaconda, WSL2 does not map localhost back to the Windows host. You'll need to access it by the Windows host IP.
The easiest method is using mDNS, meaning from within WSL2 you can access the Windows host at the mDNS name "mycomputername.local", where mycomputername is the Windows "computer name".
See this answer for more details and alternatives if mDNS doesn't work.

VMWare: Unable to access web server running on guest OS (Oracle Enterprise Linux 6.5) from host (Windows 7)

I am hosting a Oracle Linux 6.5 OS using VMWare on my windows 7 laptop. The VM is configured to use NAT networking configuration, and I am able to ping the guest OS successfully from my windows machine. Also, I am able to access internet from within my guest OS.
However, I am unable to access a web application running on port 8080 on a web server hosted within the guest OS using a browser in my host OS. The application is however accessible when accessed from a browser within the guest OS.
Some observations that may be of some use:
1. Neither my laptop, nor the VM have a static IP address.
2. I am able to ping my guest OS from host, and vice versa
3. Firewalls are disabled on both my laptop as well as the guest OS
Any help would be highly appreciated
The reason for the above issue could be mostly because of firewall settings/rules enabled in guest OS OEL. To check the rules you can type iptables -L -n at bash prompt which will display FILTER rules (CHAIN INPUT/OUTPUT/FORWARD).
Adding filters to allow the host to access guest http protocol would make things work. On the other hand, if this is for developmental purposes you can completely disable the firewall filter by saying
service iptables stop. Keep in mind that this is not a safe approach as it exposes your guest to the world without a firewall especially if you are using a bridged network connection.

Angular app not working in IE 9 on remote server

I have a simple angular application that works just fine when deployed on my local JBoss instance, but when I deploy the same war file in our sandboxed environment (also JBoss) the application doesn't load. Just shows up as a blank page. When viewed on Chrome or FF it works fine as well.
Not a lot to go on, but any pointers in the right direction would be very helpful.
Edit: Just another piece of info, it doesn't work locally on IE either when the address contains the computer name and not localhost. So http://localhost:8080/angularapp works but http://[machinename]:8080/angularapp does not.
In the post you don't make completely clear in what environments you've the problem (it's clear it doesn't work using IE, but does it work in all cases with Chrome and FF?).
But the problem you're experiencing when trying to access using the machine name (http://machinename:8080/...), may be caused because you've not defined properly the IP bindings in the JBoss startup: by default JBoss binds only to localhost (127.0.0.1), if you want JBoss to be accessed from any other network interface, you've to define it. That can be done using the -b parameter of the startup script (run.sh for Jboss 3.x/4.x/5.x/6.x or standalone.sh if it's JBoss 7). For example:
./run.sh -b xxx.xxx.xxx.xxx (where xxx.xxx.xxx.xxx is your server IP) will make the JBoss accessible only from that IP (and its corresponding machine name, provided is correctly defined in the DNS or /etc/hosts ...), but not from localhost.
./run.sh -b 0.0.0.0 will make the JBoss accessible from all the networks interfaces of your server.

trouble accessing localhost from ie7 running on parallels (win xp) on mac os x

I'm running the app engine devserver on localhost:8080, and want to access it from ie7 running on parallels.
I've tried all of the tips here:
How Do I Access The Host Machine From The Guest Machine?
And they seem like they should work, particularly accessing via the gateway ip address. I've also
sudo ipfw add allow tcp from 8080 to 8089
for good measure. Still no dice. I can access the external internet from ie7. The connection settings on parallels are set to 'Shared networking'. I'm out of ideas.
You're not by any chance running it on localhost/127.0.0.1 on OS X and are trying to get at it using localhost/127.0.0.1 from XP?
If so, that's likely to be your problem - I would seriously doubt that the two instances of the OS share the loopback interface as that's specific to the OS.
I'd run it on OS X using the local IP and not localhost, then use the IP address to access it from XP. This should work if the XP box can see the host.

Accepting a socket on Windows 7 takes more than a second

Here's what I've done:
I wrote a minimal web server (using Qt, but I don't think it's relevant here).
I'm running it on a legal Windows 7 32-bit.
The problem:
If I make a request with Firefox, IE, Chrome or Safari it takes takes about one second before my server sees that there is a new connection to be accepted.
Clues:
Using other clients (wget, own test client that just opens a socket) than Firefox, IE, Chrome, Safari seeing the new connection is matter of milliseconds.
I installed Apache and tried the clients mentioned above. Serving the request takes ~50ms as expected.
The problem isn't reproducible when running Windows XP (or compiling and running the same code under Linux)
The problem seems to present itself only when connecting to localhost. A friend connected over the Internet and serving the connection was a matter of milliseconds.
Running the server in different ports has no effect on the 1 second latency
Here's what I've tried without luck:
Stopped the Windows Defender service
Stopped the Windows Firewall service
Any ideas? Is this some clever 'security feature' in Windows 7? Why isn't Apache affected? Why are only the browsers affected?
If you're saying "localhost" instead of "127.0.0.1", you're forcing a name lookup before the actual connection attempt, adding delay.
In addition, some browsers, like Firefox 3.5+, don't use the operating system's DNS lookup mechanism, which is why it can have different performance than, say, wget.
You may be running into some automatic proxy discovery problem. In Firefox, you can disable this in Options | Advanced | Network | Settings; select either "No proxy" or give it explicit values. There's also the Internet Properties control panel, which is IE's network settings, but other browsers on Windows may obey settings here, too. Again, disable auto-proxy discovery. This can speed connections outside localhost, too.
For some reason Windows 7 takes 1 second to resolve address localhost regardless of it being in hosts file.
Adding localhost1 to hosts file and using that works around the problem.
When connecting to localhost on a IPv4/IPv6 dual stack host:
A DNS lookup is performed for localhost.
The DNS server (whether IPv6 enabled or not - this doesn't matter) returns both the AAAA record ::1, and the A record 127.0.0.1.
The client first attempts to connect to ::1.
We assume your server program is not IPv6-capable, which is a common case - due to historical reasons, many servers bind their socket to 0.0.0.0 by default rather than [::].
Here an ECONNREFUSED error would be raised for the client. This happens immediately on most platforms; on Windows however, a single call to connect() would try 3 times in 500ms intervals before giving up, hence taking a bit more than one second (See http://stackoverflow.com/q/19440364 for more details).
The client then creates a connection to 127.0.0.1 instead.
This would explain all your clues above:
If you make a request with Firefox, IE, Chrome, Safari or any other IPv6-capable clients, it takes takes about one second trying for ::1 before connecting to 127.0.0.1.
Your own test client just opens a INET socket, so it won't try ::1 at all.
Using a dual-stack server such as Apache, the clients will connect to ::1 happily.
The problem isn't reproducible on Windows XP, of which IPv6 support is not enabled by default.
The problem seems to present itself only when connecting to localhost, as your friend connected with an IPv4-only network.
Running the server in different ports has no effect on the 1 second latency.