angularjs URLs not resolving correctly on client that is running on second machine on local network - angularjs

Developed client on one machine, now trying to get it to run on another in the local network (I access the client using a URL containing an IP address rather than a hostname). The client on the new machine does not seem to recognize that it needs to use the IP to formulate URLs.

I solved this by upgrading to angularjs 1.7.7.

Related

Error while using Teams connector in Logic app - Not able to connect global.consent.azure-apim.net or logic-apis-westerurope.consent.azure-apim.net

While using Teams connector in Logic App - not able to authenticate getting below error
Not able to connect to global.consent.azure-apim.net or logic-apis-.consent.azure-apim.net
I faced this issue hence want to share the solution as well.
It seems it is system related issue. We can verify that by pinging the URLs causing the issue we will not get the IP address.
we can ask someone in the team to ping these URLs and provide us the IP address
Put these IP Address :
logic-apis-.consent.azure-apim.net
global.consent.azure-apim.net
in host file in the location -
c:\windows\system32\drivers\etc

Not able to access a port on ec2 instance for an Angular app

I am working on an angular app using the angular cli to set things up. Running the ng serve command spawns a server at this address <my_ec2_host_name>:4200. When I try to access the page on the browser it doesn't work (connection timed out error). I believe this is because of security reasons so I added the following rule to my security groups for the ec2 instance:
Port 4200 should now be accessible but I still can't get the page to load. Can someone think of how to get this to work?
Start angular with below command.
ng serve --host=0.0.0.0 --disable-host-check
it will disable host check and allow to access with IP
You can set up the host option like this:
ng serve -host 0.0.0.0
The steps you are doing are correct for opening a port via Security Groups in the EC2 console. Make sure you are modifying the correct security group, and make sure that your changes have been saved.
Your container may have additional firewalls in place, so you will want to check the OS documentation. For Example, RHEL uses iptables as a further security measure: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/sect-Security_Guide-IPTables.html.
That looks correct. Are you sure that your server is running and listening for connections?
You should ssh to that server and verify that the page can be loaded locally. Eg:
curl http://<YOUR HOST IP ADDRESS>:4200
eg: curl http://54.164.10.123:4200
You should be careful to use the public ip address (eg: IPv4 Public IP when you're in the EC2 console). I've run into problems in the past where I've got a server listening on one IP address (often localhost) and not the public ip address.
Also maybe a problem: Is your host inside a VPC of some sort?

expose local webserver behind dynamic IP

I've a simple webserver bound on 0.0.0.0:3000 on my machine which works as intended on local networks. By local network I mean to say, if my mobile or any other device is on the same network, it can access local webserver by going to the IP assigned to my machine and adding port 3000 to it. Eg 192.168.1.4:3000.
Now I've to expose it to the internet but not through some sort of 3rd party application like ngrok, localtunnel or browserSync. I know that these applications work perfectly, but since I've my own pet project of controlling home appliances, I don't want to rely on availability of 3rd party services. So the current state is, I cannot control it through the internet. Keeping in mind I don't have a static IP otherwise this would've been easier.
I already have a vps and a domain name assigned to it. I can send my currently allocated ip address (since it is dynamic), by using getifaddrs, to my server and keep track of it. But how do I expose my local server to the internet through it? Those 3rd party applications assign some sort of subdomains to each exposed server, and I'll be able to assign subdomains too, but I'm still not getting any way to expose the local webserver. Any help would be appreciated, thankyou :)
Step one, you need to expose your webserver at your internet access router.
Typically this requires you to configure port forwarding for (in your case) port 3000.
With this done, any client could access your service via (current external dynamic ip):3000
Step two, you need to dynamically map a fixed DNS name to your current dynamic ip. There are of course third party services (such as DynDNS) that would help you map yourfavoritename.dyndns.org to that ever-changing ip address.
If you want to do the latter without 3rd party, you need to have some static (web) server somewhere and could proceed as follows:
Clients visit http://www.yourstaticserver.example/ and that server redirects them to (current dynamic ip):3000.
Of course, for this to happen, your static server needs to know the dynamic ip and needs no find out about changes to it.
To this end, you could have your internal server contact the static server on a regular interval (such as once a minute), say, have it access http://www.yourstaticserver.example/some-secret-special-page and the static server always stores the REMOTE_ADDR of such a request (preferably with some authorization!) for its future redirections.
Actually, there is a step zero before step one: Be aware that exposing your server to the Internet means that you expose your server to the Internet. So I hope you have invested enough thought into security.

WebService getting the local address instead of ip address

I trying to run a silverlight app. I have a server with a knowed ip, and I am trying to install the sl app in this server.
The problem is, if I access the service using the ip like: http://serverip:port/Service.svc, the service runs with no problem, but, service shows this:
svcutil.exe http://serverLocalAddress:port/Service.svc?wsdl
So, when I run the app from the local domain, I have no problem, but, when I run from outside domain (from my house for example), the app doesn't run correctly, showing a error in the service.
I have configured my ServiceReference.ClientConfig endpoint address with: "http://serverip:port/Service.svc".
There are other place to change to fix this problem?
Regards.
Eduardo.
You may want to be explicit about your address in your code versus in your ClientConfig. This can give your more control over your url, you can event move it to your Application InitParams.
To do this, modify your service declaration to include the address and change this
_proxy = new WCFServiceClient();
to
_proxy = new WCFServiceClient("BasicHttpBinding_IWCFService", "http://serverip:port/Service.svc");
I don't recommend hard coding the address as I've done here, but this should get you started.

get ip address (when no ASP.NET available (on linux server))

I can't find the ip address without the aspx page (so on a linux server). If it can work through wcf then its also good.
I think your best bet is to let a web service return the IP address to the Silverlight client if you are able to use WCF in your application. I don't believe there is any straightforward way to get the client IP directly within Silverlight.
Just a simple web method like this should work:
[OperationContract]
public string GetClientIpAddress()
{
return HttpContext.Current.Request.UserHostAddress;
}
You might not be able to get the actual client IP address if the request is going through a proxy server, but you could check the HTTP_X_FORWARDED_FOR header as well and use that if available.
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
I wouldn't depend on that as a reliable client IP address though, since not all proxy servers honor that HTTP header and it could also be easily spoofed.

Resources