question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When knowledge runs on Apache with SSL through Tomcat, it had happened error message that is "HTTP upgrade is not supported by the AJP protocol".

See original GitHub issue

Thank you for your reading this topic. I have been using knowledge on Apache with SSL through Tomcat. When I selected “system setting” at “index rebuilding” or another some menus, it had occurred 500 error in “catalina.out”. It included a message which was “HTTP upgrade is not supported by the AJP protocol”. After error happened, I checked and set up Apache’s module which name is “mod_proxy_wstunnel”.

But I haven’t resolved this error…

Please anyone help me. Thank you.

My machine environment

OS: Amazon Linux(CentOS6)
Tomcat: Apache Tomcat/8.0.45
Apache: 2.4.27
Java: openjdk version "1.8.0_141"
knowledge: 1.10.0

/etc/httpd/conf.modules.d/00-proxy.conf

# This file configures all the proxy modules:
LoadModule proxy_module modules/mod_proxy.so
LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_express_module modules/mod_proxy_express.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

/etc/httpd/conf.d/wstunnel.conf

ProxyPass /knowledge ajp://localhost:8009/knowledge

/etc/tomcat8/server.xml

<!-- A "Connector" represents an endpoint by which requests are received
        and responses are returned. Documentation at :
        Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
        Java AJP  Connector: /docs/config/ajp.html
        APR (HTTP/AJP) Connector: /docs/apr.html
        Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
   -->
   <Connector port="8080" protocol="HTTP/1.1"
              connectionTimeout="20000"
              redirectPort="8443" />


<!-- Define an AJP 1.3 Connector on port 8009 -->
   <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Error message

INFO  2017-08-17 07:29:01,969 [LoggingFilter(100)] GET    https://example.co.jp/knowledge/admin.database/reindexing    200    IPADDRESS    17[ms]
INFO  2017-08-17 07:29:02,057 [LoggingFilter(100)] GET    https://example.co.jp/knowledge/open.account/icon/1    200    IPADDRESS    3[ms]
ERROR 2017-08-17 07:29:02,578 [ControlManagerFilter(206)] ERROR SEND
ERROR 2017-08-17 07:29:02,578 [LoggingFilter(64)] Any exception is thrown. [javax.servlet.ServletException]
javax.servlet.ServletException: javax.servlet.ServletException: java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol
    at org.support.project.web.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:300)
    at org.support.project.knowledge.listener.CloseAbleAuthenticationFilter.doFilter(CloseAbleAuthenticationFilter.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.support.project.knowledge.filter.ApiFilter.doFilter(ApiFilter.java:71)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.support.project.web.filter.LoggingFilter.doFilter(LoggingFilter.java:62)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.support.project.web.filter.SeqFilter.doFilter(SeqFilter.java:31)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.support.project.web.filter.EncodingFilter.doFilter(EncodingFilter.java:36)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:877)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol
    at org.support.project.web.filter.ControlManagerFilter.doFilter(ControlManagerFilter.java:216)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.support.project.web.filter.MultipartFilter.doFilter(MultipartFilter.java:63)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.support.project.web.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:293)
    ... 30 more
Caused by: java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol
    at org.apache.coyote.ajp.AbstractAjpProcessor.action(AbstractAjpProcessor.java:619)
    at org.apache.coyote.Request.action(Request.java:380)
    at org.apache.catalina.connector.Request.upgrade(Request.java:1932)
    at org.apache.catalina.connector.RequestFacade.upgrade(RequestFacade.java:1114)
    at javax.servlet.http.HttpServletRequestWrapper.upgrade(HttpServletRequestWrapper.java:376)
    at javax.servlet.http.HttpServletRequestWrapper.upgrade(HttpServletRequestWrapper.java:376)
    at org.apache.tomcat.websocket.server.UpgradeUtil.doUpgrade(UpgradeUtil.java:234)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:77)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.support.project.web.filter.ControlManagerFilter.doFilter(ControlManagerFilter.java:191)
    ... 36 more
INFO  2017-08-17 07:29:02,579 [LoggingFilter(100)] GET    https://example.co.jp/knowledge/reindexing    500    IPADDRESS    2[ms]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Monotacommented, Aug 21, 2017

私も WebSocket の実装はしたことありませんが、ざっとソースコードを眺めた感じだと

ProxyPass /knowledge/exporting ws://localhost:8180/knowledge/exporting
ProxyPass /knowledge/data_transfer ws://localhost:8180/knowledge/data_transfer
ProxyPass /knowledge/notify ws://localhost:8180/knowledge/notify
ProxyPass /knowledge/reindexing ws://localhost:8180/knowledge/reindexing

を先頭に書くとどうでしょうか?

org.support.project.knowledge.websocket パッケージの実装を参照して書きました。

0reactions
MatsumotoHirokocommented, Aug 22, 2017

@Monota 様、ありがとうございます。そちらの内容をproxyのconfに記載の上でtomcat + apache再起動したところ、今度はインデックス再構築でエラーがなく成功しました。(成功後メッセージポップアップは出てきませんがログ上では終わっていますので問題なさそうです) 実装確認をありがとうございます。

@koda-masaru 様、利用箇所のご説明ありがとうございます。デスクトップ通知でwebsocektが使われているのですね。あまり知見がないため非常に勉強になりました。

本当に感謝いたします。皆様がApacheを使っていないというのをお聞きし、HTTPサーバーの選択を誤りました。なんとか解決してよかったです。ありがとうございます 🙇‍♀️

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP upgrade is not supported by the AJP protocol
This worked when accessing Tomcat directly through its HTTP connector. If this is not supported with AJP, is there a workaround? apache ·...
Read more >
AJP File Read/Inclusion in Apache Tomcat (CVE-2020-1938 ...
This is a configuration issue with AJP protocol in Tomcat/Undertow. AJP is a highly trusted protocol and should never be exposed to untrusted ......
Read more >
Apache Tomcat 8 (8.5.84) - SSL/TLS Configuration How-To
Using name-based virtual hosts on a secured connection requires careful configuration of the names specified in a single certificate or Tomcat ...
Read more >
AJP connector fails to start in Jira Server due to ...
This error happens because Apache Tomcat 8.5.51 and newer have the secretRequired parameter set to true by default. When secretRequired is true ...
Read more >
Set up a reverse proxy server with ArcGIS Notebook Server ...
Install Tomcat to run on port 8080 using the Apache JServ Protocol (AJP), which is enabled by default. Because port 8443 is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found