Issue with Apache 2.4.43 https while using proxy pass - java

I am new to Apache configuration with Jboss EAP 7 as web server. I am using Jboss EAP 7 as the web server where i deployed my application which is working good. Its listening to http with port no as 8080. When i try to access the application from Apache with http , its working well. But the same from https is not working. Apache version is 2.4.43 . The below is my configuration.
<VirtualHost x.x.x.x:80>
ProxyPass /Hello http://x.x.x.x:8080/Hello
ProxyPassReverse /Hello http://x.x.x.x:8080/Hello
</VirtualHost>
The above works fine.
But the below is not working
<VirtualHost x.x.x.x:443>
ProxyPass /Hello http://x.x.x.x:8080/Hello
ProxyPassReverse /Hello http://x.x.x.x:8080/Hello
</VirtualHost>
Getting the following error. Not sure what could be the issue?The following is the error logd from Apache server:
[proxy:error] (70007)The timeout specified has expired: AH01084: pass request body failed to x.x.x.x:8080
[proxy_http:error] AH01097: pass request body failed to x.x.x.x:8080
From the browser, i get 504 error message like below.
The gateway did not receive a timely response from the upstream server or application.
Can anyone help me on this issue?
Thanks,
Suresh

It seems to be issue with my certificates. The same configuration is working fine with valid certificate in other environments.

Related

Session cookie lost in proxyPass with apache server

I have a configured reverse proxy in apache server to authenticate user throughs oauth2.
When the proxy path is different than the one in the server, the session cookie is lost and i get authorization_request_not_found error.
The following configuration is working fine while /backend in both:
ProxyPass "/backend" "http://localhost:8085/backend"
ProxyPassReverse "/backend" "http://localhost:8085/backend"
When i configure a different path i can't see the session Cookie so the authentication fail:
ProxyPass "/service" "http://localhost:8085/backend"
ProxyPassReverse "/service" "http://localhost:8085/backend"
In this case /service is different than /backend
Can you please help me through the required config to pass the cookie to the backend to keep the functionality as expected.
Thank you

Sending emails behind firewall using Apache

I've got one Debian server with access to the Internet and Apache installed on it, and it can connect to email server by static IP.
There is the second Debian server behind firewall without access to the Internet and Java application on it, it can connect ot the first server only.
Can I configure apache such as it listens to port (for example 8081) and redirects it to mail server in order to send email messages on second server?
I tried this:
1) configure second server to send email to the first server using port 8081 (not 25).
2) add new port in /etc/apache2/ports.conf and to add new VirtualHost as described below.
<VirtualHost "*:8081">
#VirtualHost for email server
ProxyRequests On
ProxyPass / http://mail_server_ip:25/
ProxyPassReverse / http://mail_server_ip:25/
<Location />
Order Deny,Allow
Allow from all
</Location>
</VirtualHost>
But nothing meaningful happens, only SocketTimeoutException and javax.mail.MessagingException: Exception reading response.
Is Apache suitable for this task? Is there any way to do it properly?

Spring-boot behind dedicated Tomcat behind Apache2 proxy?

I'm running a apache2 reverse proxy that sends the request to a dedicated tomcat8 on localhost:8080
For proper self-reference within my applications, I need to forward the https headers accordingly. Therefor the proxy is configured as follows:
<VirtualHost *:443>
ServerName www.myapp.org
ProxyPass / http://127.0.0.1:8080/
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-Forwarded-Port 443
ProxyPreserveHost On
... (SSL directives omitted for readability)
</VirtualHost>
Now the spring advise is to set the following application.properties in case of running an embedded tomcat behind an proxy:
server.use-forward-headers=true
server.tomcat.remote_ip_header=x-forwarded-for
server.tomcat.protocol_header=x-forwarded-prot
Problem: as I'm running a dedicated tomcat, any server.* properties are ignored.
Question: how can I achieve the same configuration for the dedicated tomcat?

Tunelling websockets calls through Apache on TLS to non TLS Tomcat server

We are using websockets in one of our projects. Our setup has an Apache Web Server and a different server with Tomcat instance. Apache is on TLS but the tomcat instance does not have TLS.
We are trying to tunnel the websockets through the apache (wss) to tomcat instance (ws).
Is this possible ? The initial handshake is successful and we get a 101 Response status. After that when we try to send data through the web socket, it does not reach the tomcat instance.
Any help would be greatly appreciated.
Below is the section of configuration used for websockets from the httpd.config file.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule ssl_module modules/mod_ssl.so
ProxyPass wss://apache/ws/connect ws://tomcatinstance/wsapp/connect
ProxyPassReverse wss://apache/ws/connect ws://tomcatinstance/wsapp/connect

apache2.4.6 wstunnel proxying to tomcat 7 error unexpected 200 repsonse

I have everything being proxy correctly just that my websockets keep giving me an unexpected 200 response error. I am using native websockets on chrome and firefox.
my conf file looks like this
<VirtualHost example.com:80>
ServerName example.com
ProxyRequests Off
ProxyPass /websocket/ ws://localhost:8080/XXXXX/websocket/ retry=0
ProxyPassReverse /websocket/ ws://localhost:8080/XXXXX/websocket/ retry=0
ProxyPass / http://localhost:8080/XXXXX/
ProxyPassReverse / http://localhost:8080/XXXXX/
ProxyPassReverseCookiePath /XXXXX /
</VirtualHost>
Here is the exact error, so there is no confusion.
Error during WebSocket handshake: Unexpected response code: 200
I had a similar Problem with modproxy and wstunnel module in apache2 version 2.4.10 on Ubuntu 15.04. I used tcpflow to figure out what happened and saw that my HTTP Proxy worked correctly and sent everything to my nodejs server, but my websocket Proxy directly returned the website at /.
Luckily, i had a working Debian server with nearly the same configuration, and I found out the only difference was the following:
On the non-working server:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
On the working server:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
I don't know why this worked in my case, but I hope adding the Directory directive to your VirtualHost will solve your Problem too.

Categories

Resources