tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nishant singh <singhnishan...@gmail.com>
Subject Status code 403 Forbidden issue for websocket creation using WSS protocol
Date Thu, 09 Mar 2017 18:16:44 GMT
Hi,

   I am creating a websocket connection to server using "wss" protocol from
client.  I have configured apache as proxy(mod proxy and
mod_proxy_wstunnel.so module is enabled in Apache httpd.conf file) to my
tomcat server. In apache VirtualHost for port 443 is created.Attached is
Apache httpd.conf file for reference.Tomcat connector for ssl is mentioned
below. I am getting response  status code 403 Forbidden for websocket
request sent from client using "wss" protocol. The  same set-up works fine
using "ws" protocol websocket connection on port 80 of apache proxied to
port 8080 of tomcat.I assume that SSL handshake is failing in this
scenario. Please suggest the solution.
Tomcat version:-9.0.0.M13
Apache version:- 2.4.23

======in Tomcat Server.xml connector configuration on port 443======
 <Connector port="8443" SSLEnabled="true"
              scheme="https" secure="true"
              clientAuth="false" sslProtocol="TLS"
 SSLCertificateFile="\conf\certificate.pem"
SSLCertificateKeyFile="\conf\privkey.pem" />

==========================Chrome debugger trace for this Request====


[image: Inline image 1]

===================sample websocket code for request creation From client
==================
 this.websocket = new
WebSocket("wss://localhost:443/NG/nmsgServletApp/wsHandler/");

      this.websocket.onopen =  (evt) => {
          this.websocket.send("Hello Nishant");
      };
//nmsgServletApp:--> is my application name which is deployed in tomcat
//wsHandler:--> is the server side websocket handler mapping name
//NG:--> Proxy token for web-application deployed in Tomcat

====================Apache virtual port configuration for request proxy to
tomcat===================================
 <VirtualHost *:443>
    SSLCertificateFile ../certificate.pem
    SSLCertificateKeyFile ../privkey.pem
    ServerAdmin abc@localhost.com
    ServerName "localhost"
    SSLEngine on
    SSLProxyEngine on
    SecRuleEngine On
    ProxyRequests Off
/*Below is Proxy configuration for above web-application deployed in Tomcat
*/

   * ProxyPass /NG/nmsgServletApp/wsHandler
wss://localhost:8443/nmsgServletApp/wsHandler*
*    ProxyPassReverse /NG/nmsgServletApp/wsHandler
wss://localhost:8443/nmsgServletApp/wsHandler  *
*    ProxyPass /NG https://localhost:8443/ <https://localhost:8443/> *
*    ProxyPassReverse /NG https://localhost:8443/ <https://localhost:8443/>*

/*Below is Proxy configuration for another application deployed in another
server*/

    ProxyPass / https://localhost:49101/ retry=10
    ProxyPassReverse / https://localhost:49101/

 <Proxy *>
        ProxyPreserveHost Off
        Order deny,allow
deny from all
        Allow from all
        SetOutputFilter DEFLATE
    </Proxy>
  </VirtualHost>
==================================================================

Please let me know if some more info is required or my description of the
problem is not clear.Please guide..

Thanks,
Nishant

Mime
View raw message