How to configure Tomcat as response to DNS request? - windows

Hope you're all doing fin!
I'm working at a company where the main application is at a web page made with Java. It deploys with Tomcat on a server with Microsoft Windows Server 2008 R2 O.S. I've recently made some changes on this application, but the development environment is not on Tomcat but on JBoss and the former developers knew how to deploy the development from JBoss to Tomcat, but didn't leave any documentation on how to do that.
My problem is that the DNS server is associated with Tomcat, so my development deployed on JBoss can only be accessed through IP address.
My team and I spoke to the company in charge of the DNS server and it indicated that Tomcat's configuration as DNS response should be made by us, given that this company is only in charge of redirecting the IP without specifying the web server.
In order to solve this problem I have two proposals which I don't know how to implement:
1. Modify the server configuration in order to respond to the DNS server through JBoss, overwriting Tomcat response.
2. Deploy the application made on JBoss on Tomcat server.
I would really appreciate your help with any of these proposals. It is a very important matter for the company.
Thanks a lot beforehand for your help.

Related

Getting Client ip address without change software code

We have haproxy and websphere in different machines to publish software. Software try to insert client's ip to database however it insert IP of haproxy. Programmers only use this code and they do not change.
ipAddress = request.getRemoteAddr();
I got tcpdump and i can see client's ip is on x-forwarded-for tag of http layer. Software does not use this tag to get, i think. Is there any way to change x-forwarded-for to remoteaddress? Is there any tips to get client's ip without change software code? What should i do in the websphere servers or haproxy layer?
Websphere version 8.5.5.11
haproxy version 1.8
Well as websphere is a commercial product I would suggest to ask IBM which parameter should be set in websphere.
A short search in the Internet have bring up this page
Potential WebSphere Application Server problems when deployed behind a WebSphere-aware proxy server linked from this page HTTPServletRequest.getRemoteAddr/getRemoteHost starts to return WebSphere Plugin host value from 8.5.5.16 or 9.0.0.11.
Tomcat have for this the Remote IP Valve, I assume that websphere have a similar option.
I also strongly recommend to use a more recent version of HAProxy as the 1.8 will be soon end of live https://www.haproxy.org/ .

Make netty server on localhost accesable over internet

I have developed a Jooby-Application which is hosted on a netty server. I can access the application on localhost and tests were fine. Now I want to make the app accessable over internet and dont know what is the best way to reach this goal?
The complete application is hosted on a Windows Server, because it uses Excel. (Read/Write over Apache POI. For macros it has to be Windows) Should I try to connect the running netty-server with IIS or can I just forward the requests from outside to localhost? The last mentioned approach propably is a bad idea regarding security issues.
It works with reverse proxy over IIS. I had to install some features like Application Request Routing and URL Rewrite. Then I can start the jooby application (netty server) as usual on a specific port at localhost and set a reverse proxy to it.
I am not sure why being on a window is necessary, anyways, Netty is just a Java network programming framework, it can run on any platform where Java is installed.
You need to host a server, you can buy a VPS, install windows as OS, install Java, you can run your application as you like.
What I understand is you need to test it, for that you can use any port forwarding service like https://pagekite.net/support/intro/features/ to enable "world access" to localhost

Move Confluence to subdomain (no port) on JIRA server, with Tomcat

I'm using both JIRA and Confluence on the same server, running on Windows, using Apache Tomcat.
I have two domains pointing at the server, jira.company.com and confluence.company.com.
JIRA is running fine on port 80 in the Apache Tomcat instance, and I can get to that on the JIRA.company.com domain just fine.
Confluence is currently running on port 8090 on the same machine. What I'm trying to do is get Confluence working on the confluence.company.com domain.
Most of the documentation I can see is about configuring virtual hosts and reverse proxies in httpd.conf, however in Apache Tomcat all I have to work with is the server.xml file.
I understand I can add another host to the JIRA server.xml file to point to a different docBase for Confluence, but I have a feeling this breaks Atlassian's own recommendations found here.
When I add an additional host entry into Confluence's server.xml it's ignored, and the confluence.company.com domain sends me through to JIRA.
I've done some searching and found similar questions but they don't seem to apply to my configuration - they all mention httpd.conf which isn't present on my server.
My questions:
Can I run Confluence on the subdomain by adding an extra entry in JIRA's server.xml? If possible, is this bad?
Is there another way to get my Confluence Apache instance listening on port 80 but on it's own domain name?
I can do all this on IIS with my eyes shut, but in Apache/Tomcat I'm a little lost. Thanks in advance!
Tomcat is not really meant to directly handle incoming requests as usually an Apache or other proxy is put in front of it to hide the ports and provide other useful features you would need for Single Sign On etc. Note that there is a difference between the Apache Webserver, which is commonly only called "Apache" and "Apache Tomcat", which is only an application server made by the Apache Foundation community and named "Tomcat". Tomcat only supports basic webserver functionality.
In any case, you can use the IIS as a webserver and proxy to forward the requests and at the same time hide the ports of the applications. I personally haven't used IIS but Atlassian offers a thorough explanation for the Confluence and/or JIRA integration with IIS as a proxy: https://confluence.atlassian.com/adminjiraserver071/integrating-jira-applications-with-iis-802593039.html
The page covers JIRA for the most part but section 4 also has additional information if you want to hook up both JIRA and Confluence on the same server, which is exactly your use case.

troubleshoot between plugin and application server?

the request from ihs is passed to plugin then to the application server and server received it.there is no cluster environment here.the server is up and running fine.But the response is not going back to plugin.how to troubleshoot?
(I would have made this a comment, but I don't have enough rep points).
You may need to engage IBM WebSphere Support to assist with this, but typically, for that type of issue, you would need to trace both sides of the connection (IHS plugin and WebSphere). Specifically,
Set LogLevel="Trace" in the plugin-cfg.xml
Set the following trace spec on the AppServer:
=info:com.ibm.ws.webcontainer=all:com.ibm.wsspi.webcontainer*=all:HTTPChannel=all:GenericBNF=all:TCPChannel=all
Reproducing the failure and reviewing the http_plugin.log and trace.log may provide some clues.
Do you receive some type of error in the browser? timeout? Is there anything (firewall, proxy) sitting between the IHS server and WebSphere AppServer?
It could be DNS problem with your WebSphere server. Can you please let us know about your IHS and plugin. Is it installed on same server where WebSphere is or on different server? If IHS and plugin is on different server just check that WebSphere server is able to resolve the IP address of IHS server using hostname. If not try to update host file with IP and hostname of your IHS server. It should work.
Does the client or the plugin not getting the response? Will that the request result in secure connection (i.e HTTPS/SSL...)?
The WAS server should extract most of the ports correctly if IHS/plugin is used in between. If using different webServer/load balancer(LB), the WAS server may not extract the listerning ports on the webServer/LB correctly.
You can take a look at the sample setting in PK55330 where a different web server is used in place of the IHS.
http://www-01.ibm.com/support/docview.wss?uid=swg1PK55330
Regards,

Redirect tomcat to maintenance page when my tomcat is down

I just joined a new company and it was told that the sites they have uses tomcat. And, they want to show a custom web page when tomcat is down. currently it will show Error 500. I am the only person in IT team for now and I am pretty new to tomcat and do not have knowledge about tomcat.
Can someone please explain how to setup a custom web page when tomcat is down?I am using only tomcat not apache or load balancer infront of tomcat.
Thanks in advance.
You have to use apache 2 or load balncer in front of tomat.And configure a maintenance page in apache or load balancer.
If you have any problem just post it
This answer may not the correct way but hope it will help to the folks who do not want to use (or not allowed as in my case) apache 2 or load balancer in front of Tomcat server. This solution is for Tomcat servers that contains only one application instance.
I also had a similar problem and they expected a solution without having apache 2 or load balancer in front of tomcat (because it’s a live project and they do not want to change the architecture).
I used two instances of Tomcat server to come up with a solution. The OS is windows and Tomcat server configured as a windows service.
I copied the Tomcat server and create another windows service for this new server. Then I created a dummy project (war file name is same as the original project name) with maintenance html file and deployed it in the new Tomcat server.
Finally created two batch files, one for stop the main Tomcat server and start the maintenance Tomcat server and other one to reverse this process. So once you execute the batch file it will stop the main Tomcat server and bring up the maintenance Tomcat server.
Below is a sample can use in batch file.
#echo off
echo Main Tomcat server will stop
NET STOP "Tomcat9"
echo Maintenance Tomcat server will Start
NET START "Tomcat9-MAINTENANCE"
PS: We can use these batch files in Windows Task schedulers also.

Resources