How to enable AJP port in Payara Micro and Use Apache server as proxy - apache

I am using Payara micro community edition to deploy a microservice REST APIs. I need to enable AJP port so that the Apache proxy server listens to the AJP port 8192.
java -jar payara-micro-5.2020.5.jar --deploydir ./payara/webapps --rootDir ./payara --postbootcommandfile ./payara/postboot.txt
./payara/webapps folder contains the microservice WAR file.
postboot.txt content:
create-network-listener --protocol http-listener-1 --listeneraddress 0.0.0.0 --listenerport 8192--jkenabled true jk-connector
The command execution has no issues and following ports are enabled "Http Port(s)": "8080, 8192".
I am able to use the microservice APIs locally (http://localhost:8192/). But the requests from Apache proxy shows Bad Gateway error.
Am I missing some configuration for AJP port enabling in Payara Micro?

AJP port is enabled for Payara by adding this line in the domain.xml
<network-listener protocol="jk-listener" jk-enabled="true" port="8192" name="jk-connector" thread-pool="http-thread-pool" transport="tcp"></network-listener>

Related

TURN server under proxy pass with Apache web server

I am trying to my own coturn (TURN) server. I want it to run on port 443. I have Apache already running on that port. Can i use Apache proxy pass to run TURN on port 3479, 53499 but still listening to port 443?
I am not sure how to go about this problem. Is my approach wrong?. If yes, whats the better approach
listening-port=3478
alt-listening-port=3479
tls-listening-port=5349
alt-tls-listening-port=5350
#stening-port=80
#tls-listening-port=443
listening-ip=127.0.0.1
relay-ip=127.0.0.1
external-ip=*****
realm=explain.bookmane.in
server-name=explain.bookmane.in
lt-cred-mech
userdb=/etc/turnuserdb.conf
Apparently, the latest version of COTURN, COTURN 4.5.2r3, recently released this year, and still marked as unstable, has just incorporated support for reverse proxy. I infer this from description I found in its config file: /etc/turnserver.conf
https://github.com/coturn/coturn/blob/master/examples/etc/turnserver.conf
This is what it says:
# Some network setups will require using a TCP reverse proxy in front
# of the STUN server. If the proxy port option is set a single listener
# is started on the given port that accepts connections using the
# haproxy proxy protocol v2.
# (https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)
#
#tcp-proxy-port=5555"

SSL springboot Verify the connector's configuration

I want to use ssl in my springboot app. I use this tutorial but when I try up start my app gives me this error:
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8443 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8443, or configure this application to listen on another port.
And my application.properties
#ssl
server.port=8443
server.ssl.key-alias=alias
server.ssl.key-password=password
server.ssl.key-store=classpath:keystore.jks
server.ssl.key-store-provider=SUN
server.ssl.key-store-type=JKS
Or do you know another way to do SSL trusted?
Generate the key with command line running in admin mode.

Wildfly 8.1 - Websockets in a Clustered Config?

I have a 2-node cluster setup using the standalone-full-ha.xml configuration on Wildfly 8.1. I'm trying to open up a web socket connection through Apache HTTPD URL, but when I do I see the following error in my logs, and the web socket open fails with an error in JavaScript:
2014-07-28 15:58:52,675 ERROR [io.undertow.request] (default task-4) UT005023: Exception handling request to /WebSocketTest/hello: java.lang.IllegalStateException: UT000077: The underlying transport does not support HTTP upgrade
Is there any way to get such a configuration working in a clustered setup? Or would I need to go to the specific app server port directly and bypass Apache HTTPD?
what version of Apache httpd are you using?
Web Sockets seem to be supported from 2.4 with mod_proxy_wstunnel
also undertow's documentation states that AJP does not support protocol upgrade

SailsJS on production - Error: listen EADDRINUSE

I have a VPS server with CentOS and Apache server.
But I want to run my node.js applications too. I am using sails.js
This sails application is trying to listen to port 80 of specified host.
Here is error (after sails lift running):
debug: Starting server in /var/www/user/data/nodeprojects/projectname...
info - socket.io started
debug: Restricting access to host: projectname.com
warn - error raised: Error: listen EADDRINUSE
warn:
warn: Server doesn't seem to be starting.
warn: Perhaps something else is already running on port 80 with hostname projectname.com?
What is the problem? Can I run both apache and nodejs servers on one server with one port (80)?
No, you cannot.
When a server process opens a TCP port to answer requests, it has exclusive use of that port. So, you cannot run both SailsJS and Apache servers on the same port.
Having said that, you can do lots of interesting things with Apache, such as proxying specific requests to other servers running on different ports.
A typical setup would have Apache on port 80 and SailsJS on port 8000 (or some other available port) where Apache would forward requests to certain URLs to SailsJS and then forward the reply from SailsJS back to the browser.
See either configuring Apache on Mountain Lion proxying to Node.js or http://thatextramile.be/blog/2012/01/hosting-a-node-js-site-through-apache for example implementations of this approach.
you cannot use same port for different application. NodeJS can use any open port. What you need todo is port forwarding for your app. :)

Jboss Pausing AJP port

I'm trying to connect Apache WS to JBoss via AJP protocol. The problem is that JBoss pauses the binding for the ajp port.
Here's the log:
[JBoss Shutdown Hook] : AjpProtocol - Pausing Coyote AJP/1.3 on ajp-8081
Any help is appreciated.
Thanks
Problem solved by disabling HTTPS connector on port 8443.