MapStore2 icon indicating copy to clipboard operation
MapStore2 copied to clipboard

Update HTTP-Proxy with support of corporate proxy

Open offtherailz opened this issue 3 years ago • 13 comments

Description

We can update the proxy for this: https://github.com/geosolutions-it/http-proxy/issues/65

When this issue is solved, we need to update the dependency to the proxy.

What kind of improvement you want to add? (check one with "x", remove the others)

  • [ ] Minor changes to existing features
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [x] Build related changes
  • [ ] CI related changes
  • [ ] Other... Please describe:

Other useful information

offtherailz avatar Mar 10 '22 11:03 offtherailz

@offtherailz as soon as @taba90 confirm this we can proceed on changing the dependency to 1.3-SNAPSHOT in master to do needed tests.

tdipisa avatar Mar 23 '22 14:03 tdipisa

@offtherailz, thanks to this we can proceed to update the http-proxy dependency to 1.3-SNAPSHOT in master branch to test in DEV.

tdipisa avatar Mar 24 '22 11:03 tdipisa

It seems we still have problems with the latest 1.3-SNAPSHOT of http_proxy. Sample of request performed by MapStore catalog tool is:

curl 'https://dev-mapstore.geosolutionsgroup.com/mapstore/proxy/?url=https%3A%2F%2Fgeorchestra.geo-solutions.it%2Fgeoserver%2Fwms%3Fservice%3DWMS%26version%3D1.3.0%26request%3DGetCapabilities' \
  -H 'Connection: keep-alive' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://dev-mapstore.geosolutionsgroup.com/mapstore/' \
  -H 'Accept-Language: en,it;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6' \
  -H 'Cookie: _gcl_au=1.1.694834413.1648205893; _ga=GA1.2.1500297756.1648205893; _gid=GA1.2.1032213120.1648205893' \
  --compressed

The error if HTTP 500 while the reported exception is:

javax.servlet.ServletException: Servlet.init() for servlet [HttpProxy] threw exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
	org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:433)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.base/java.lang.Thread.run(Thread.java:829)
</pre><p><b>Root Cause</b></p><pre>java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
	org.apache.http.impl.conn.PoolingHttpClientConnectionManager.getDefaultRegistry(PoolingHttpClientConnectionManager.java:116)
	org.apache.http.impl.conn.PoolingHttpClientConnectionManager.&lt;init&gt;(PoolingHttpClientConnectionManager.java:123)
	it.geosolutions.httpproxy.HTTPProxy.init(HTTPProxy.java:135)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
	org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:433)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.base&#47;java.lang.Thread.run(Thread.java:829)

tdipisa avatar Mar 25 '22 13:03 tdipisa

@taba90 I've reverted the dependency in MS master. Do you have any news for the fix?

tdipisa avatar Mar 29 '22 12:03 tdipisa

@tdipisa We had a quick call with @taba90 and @offtherailz to check this. I was not able to reproduce this. the tests were done for both HTTP and HTTPS on a local setup. The mapstore was built using the 1.3-SNAPSHOT version of the http-proxy. Looks like the problem is not even related to dependency conflicts as well. can you please deploy it again and share with us the logs (at debug level)?

shad-git avatar Apr 06 '22 10:04 shad-git

I did this PR: https://github.com/geosolutions-it/MapStore2/pull/8071 for testing. Please merge as well as you are able to test and revert as well as you have sufficient information

offtherailz avatar Apr 08 '22 12:04 offtherailz

I did this PR: #8071 for testing. Please merge as well as you are able to test and revert as well as you have sufficient information

@offtherailz let's coordinate things better since the last time we had problem in DEV for this. @shadab-geo let us know a bit in advance when you can spend time on this so that we will merge the PR for your test and eventually revert it again if necessary early after. To capture the log of your test you can ask @randomorder and maybe schedule a quick session with him.

tdipisa avatar Apr 08 '22 13:04 tdipisa

@randomorder could you download the log from MapStore QA so we can investigate the issue?

taba90 avatar Aug 03 '22 15:08 taba90

@randomorder provided me logs. Checking this...

taba90 avatar Aug 04 '22 14:08 taba90

@tdipisa It is another dependency conflict issue this time with a print-lib transitive depedency. Shadab was not able to reproduce locally because the test was done with the print extension. I'm opening a pr to put an exclusion on the depenency at stake in the print-lib pom.xml.

taba90 avatar Aug 04 '22 15:08 taba90

opened pr on master for print-lib see here https://github.com/geosolutions-it/mapfish-print/pull/55

taba90 avatar Aug 04 '22 15:08 taba90

@taba90 @randomorder thank you so much, really. @taba90 please check my review here

tdipisa avatar Aug 05 '22 09:08 tdipisa

@taba90 after the updates below deployed in MS QA instance through this PR, the problem still exist. Below is the error that seems to be the same:

https://github.com/geosolutions-it/mapfish-print/pull/55 https://github.com/geosolutions-it/mapfish-print/pull/56 (the backport to geosolutions-2.1.x) used by MS QA)

<!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Servlet.init() for servlet [HttpProxy] threw exception</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>javax.servlet.ServletException: Servlet.init() for servlet [HttpProxy] threw exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
	org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:433)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.base&#47;java.lang.Thread.run(Thread.java:829)
</pre><p><b>Root Cause</b></p><pre>java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
	org.apache.http.impl.conn.PoolingHttpClientConnectionManager.getDefaultRegistry(PoolingHttpClientConnectionManager.java:116)
	org.apache.http.impl.conn.PoolingHttpClientConnectionManager.&lt;init&gt;(PoolingHttpClientConnectionManager.java:123)
	it.geosolutions.httpproxy.HTTPProxy.init(HTTPProxy.java:135)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
	org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:433)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.base&#47;java.lang.Thread.run(Thread.java:829)
</pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class="line" /><h3>Apache Tomcat/9.0.65</h3></body></html>

Beside that, as per naming convention we agreed in the team the tag name here should be geosolutions-2.1.0 and not v2.1.0

Considering the above I'm forced to restore again the http_proxy 1.1.1 for 2022.02.xx branch to allow QA functional testing for 2022.02.00.

Let's wait to merge #8459 for master branch for the moment to see if we can solve before the problem for 2022.02.xx shortly to use the new fixed version of http_proxy also in master.

tdipisa avatar Aug 09 '22 08:08 tdipisa

@taba90 working now in QA as reported here

tdipisa avatar Aug 30 '22 10:08 tdipisa