Making web application go Public - jboss

I have my web Application deployed in jboss web server. It contains Servlets. Right now its url is localhost:8080/MyWebApp I want to make it public so that the clients not in localhost can also access MyWebApp. I am new to this so I am not pretty sure about how to do this. I have browsed through many sites offering a domain but I dont understand where will my Server reside. Can I make my own System as Server and run jboss Server?

Regarding listening only on localhost, take a look at your startup scripts ; to make it listen on all the network interfaces you can use
run.sh -b 0.0.0.0
To listen only on a particular ip use
run.sh -b 1.2.3.4
Ideally you do not want users to access http://some_server:8080/MyWebApp but something like http://some_server/MyWebApp. To do this you will need to setup Apache with mod_jk and proxy the requests to jboss. If you have never done this before, it might be challenging. But there are plenty of resources on the internet to help you perform this task.

Related

Is it possible to expose an Owin service?

We have created self-hosted services using OWIN. They are working fine inside the server and we can request and retrieve information using the http://localhost. We use a different port for each service so that we can go and get certain information from http://localhost:8001, other from http://localhost:8015 and so on.
Now, we need to expose the results of one of those self-hosted services to access to it through internet. We'd like to provide a custom address such http://ourpublicinfo.mydomain.com:8001 or using the server ip such http://209.111.145.73:8001.
Is that possible?
How can we implement it?
Our server OS is Windows Server 2012 R2
OWIN Self-Hosted apps can run on a Windows Service, as a Console process and, with if desired, as part of a more robust Host like IIS.
Since you mention your app is running as a service you're probably missing all the GUI goodies IIS provides. In reality however, IIS works on top of http.sys, just as HttpListener does (which is probably what you're using to self-host your app) 1. You just need to do some manual set up yourself:
First of all, you need to make a URL reservation in order to publish on a nonstandard port.
Why would you do that? Quite simply because you're not running under localhost alone anymore on your very own local machine, where you probably are an admin and/or have special privileges/powers.
Since this is a server, and the user used for running the Service might not be an admin (most probably), then you need to give permission to that user to use that URL... and here is where URL reservations come into scene.
You pretty much have to options:
open up the URL to be used by any user:
netsh http add urlacl url=http://209.111.145.73:8001/ user="everyone" listen=yes
or open up the URL to be used by the user(s) running the service, e.g.: NETWORK SERVICE:
netsh http add urlacl url=http://209.111.145.73:8001/ user="NETWORK SERVICE" listen=yes
There is a way to make the reservation for several users too, using sddl, user groups, etc... but I'll not get into it (you can look that up).
Second of all, you need to open up a hall through your firewall (if you don't have one on this day and age, I pity you!)
There are plenty of tutorials on this. You can use a GUI, netsh.exe and what not.
Pretty much all you need to do is make sure you allow incoming connections through that port and that should do the trick.
To make sure the hall is open through and through you can use a tool like http://www.yougetsignal.com/tools/open-ports/ and insert 209.111.145.73 in the Remote Address and 8001 in the Port Number.
If for some reason it shows that the port is closed, even after creating an incoming rule in your firewall for it, then you probably have one or more firewalls in between your server and the outside world.
With those to elements in place you should be able to access your Self-Hosted Service from the outside.
As for accessing your service through an address like http://ourpublicinfo.mydomain.com:8001, you'll need to create a DNS entry somewhere, most likely on your Domain Registrar for mydomain.com, where you could create an A Record for your ourpublicinfo subdomain pointing to 209.111.145.73.
From this point on, you should be able to access your service through direct IP and Port or through the afore mentioned URL.
Best of luck!
Note:
If your service will be access from other domains, you might need to make sure you have CORS (Cross Origen Resourece Sharing) well defined and working on your service too ;)

Application Server and Web Server on Two Different Machines

Today I'm hosting a Laravel v4 web application on a MacMini. Why a Mac? Because I created the application logic in Objective-C (leveraging my experience with iOS dev). Whether or not this was the right choice isn't the point of the question.
What I'm interested in knowing is how can I separate my web and application server. For instance, if I put my web server on Linode (or whatever) how do I go about communicating back and forth between the web server and the application server? Is there some sort of resource I can look to to understand how to do this?
Assumptions
Here's some assumptions I'm making:
I'm guessing Laravel and the Objetive-C Application are part of the same "system" and so I'm just gonna treat this as if you need a web server to send requests to a PHP application.
The Linode server will be a web server which sends request to the PHP application (Laravel)
Hosting PHP Applications
There are three moving parts:
The web server (Apache, Nginx)
The application gateway (PHP-FPM)
The application
The gateway and the code must live on the same computer/server. The web server can live on a separate computer/server.
This means you'll need your Macintosh to run PHP-FPM, which can then listen for remote connects and send them to the PHP application.
Macintosh
Install php-fpm on your mac. Make sure it can listen for remote network connections. This is usually done in the www.conf file in the listen directory, you can listen for connections on the remote network interface (whatever IP address the computer is assigned).
Linode
Install Nginx or Apache and have it proxy FastCGI requests off to your macintosh server at the macintosh's IP address (the one you set up to listen to addresses in the step above).
Firewalls
You may need to ensure the firewalls at both ends allow incoming/outgoing connects on the networks being used to communicate to eachother.

apache camel - deploying with cxfs web service

I'm trying to deploy my camel app which on start is creating a cxfrs endpoint. The url is like this: http://localhost:9876 . When I try to hit this one on a rest client or anywhere within my machine it works. But when I try to access it using my phone or other external devices, I'm not able to connect.
Am I missing something?
TIA
Using localhost will mean it is only accessible to your local machine, using 0.0.0.0 instead should make it publicly accessible.
0.0.0.0 should bind all available network interface on your remote machine, but from your description, somehow it only bind to localhost|127.0.0.1 so only accessible from local machine, could you use
http://external.ip.address:9876/foo/FooService
instead to see if it helps?
Also, you can try to access other network service(for example start a tomcat on remote machine and see if you can access it from your local machine) from that remote machine to see if it works, this can determine if your DNS correct or if there's really no firewall between them.

How to access JBOSS Restful web service using IP and Port

I created a test JBOSS web service and there is only one test method in it. I access this using http://localhost:8070/MyWebService/MyRESTApplication
and it shows the result from the web service. I tried this in both Eclipse and Browser and it works.
But when i want to access this web service using IP address of my system then it shows ERROR message that Page cannot be displayed (in fact browser is not able to find this web service).
I want to access like this http://IPaddress:8070/MyWebService/MyRESTApplication
what should i do so that i can access it using my IP from some computer
You have to start JBoss using :
./run.sh -b [your_IPaddress]
On windows:
start run.bat -b 0.0.0.0
This will tell it to start and bind to all network interfaces. You can also replace 0.0.0.0 with your actual IP if you only want it to bind to that network interface.
I find it easier for debugging to have it come up on all network interfaces because this will work when you are running a virtual machine to debug something like Internet Explorer.
Open your server setting in Eclipse and set Host name as your IP address or 0.0.0.0

GWT dev mode not accepting requests forwarded through router

Our application uses the PayPal api, in order to test it PayPal needs to be able to post data to a serlvet on our servers. This is no problem in production however when running in GWT-Dev mode I cannot seem to get GWT to work through my home router. GWT is running on port 8888 and I have added the needed firewall rules to get this to work.
Does GWT somehow stop requests from working from outside the local area network? I tried -bindAddress 192.167.x.x but it did not work.
For security reasons the jetty server used in gwt dev mode only binds to localhost.
If you want to bind it to all intefaces use the parameter -bindAddress 0.0.0.0
To make sure the servlets are reachable try to connect from a different host on your network (e.g. with Telnet).