Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] ProxyServlet$Transparent returns 502 for external sites

I had downloaded the latest Jetty 9.4(July 23), ran the demo-base and clicked the “Javadoc (via transparent proxy)” link.
Even though I had set up Java to use my company proxy using -Dhttp.proxyHost etc.. it still gave me a 502 Bad Gateway.
 
I’m suspecting that the Javadoc-site switching from HTTP to HTTPS (as do many sites) is part of the issue. (see the stacktrace below)
Can someone confirm that setting up a network-proxy and clicking the demo-base Javadoc link works?


Jetty's HttpClient (what's used in the Proxy code) does not use the Java JVM wide proxy system properties. (like `http.proxyHost`, `http.proxyPort`, etc...)

This is an intentional decision, as having JVM wide network configuration options on a server environment is very undesirable.

If you want to configure the proxy settings on Jetty's HttpClient that's used in Jetty's Transparent Proxy, then you'll have to change the code.

To start you'd override the method HttpClient ProxyServlet.newHttpClient()

Then you would create the HttpClient and apply the proxy behaviors that best suites your environment.

See https://www.eclipse.org/jetty/documentation/current/http-client-proxy.html


Joakim Erdfelt / joakim@xxxxxxxxxxx


On Wed, Sep 4, 2019 at 9:09 AM Houtman, Roland <Roland.Houtman@xxxxxxxxxxxxxxx> wrote:

Hi Team,

 

I had downloaded the latest Jetty 9.4(July 23), ran the demo-base and clicked the “Javadoc (via transparent proxy)” link.

Even though I had set up Java to use my company proxy using -Dhttp.proxyHost etc.. it still gave me a 502 Bad Gateway.

 

I’m suspecting that the Javadoc-site switching from HTTP to HTTPS (as do many sites) is part of the issue. (see the stacktrace below)

Can someone confirm that setting up a network-proxy and clicking the demo-base Javadoc link works?

 

 

Kind regards,

Roland

 

From: jetty-users-bounces@xxxxxxxxxxx <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Houtman, Roland
Sent: Tuesday, July 23, 2019 11:11 AM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] ProxyServlet$Transparent returns 502 for external sites

 

Gents,

 

Seeing this issue happens even in the latest Jetty,

 

> I downloaded Jetty latest 9.4, ran the demo-base and was looking around,

>  Then I found that the transparent-proxy is used for redirecting to the online Javadoc

>  It is in the middle column “information…” the link  “Javadoc (via transparent proxy)”

>  There I also get “502 bad gateway”

 

Is the “502 bad gateway” a common issue for the “Transparent Proxy” when behind a company proxy?

It happens even though I setup Java to use my company proxy.

 

 

Rergards

 

From: jetty-users-bounces@xxxxxxxxxxx <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Houtman, Roland
Sent: Friday, July 19, 2019 10:44 AM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] ProxyServlet$Transparent returns 502 for external sites

 

I also tried;

 

1 ### Let Jetty use PROXY settings

using the next flags for the VM in order to let Jetty use our company proxy

               -Dhttp.proxyHost=

               -Dhttp.proxyPort=

               -Dhttps.proxyHost=

               -Dhttps.proxyPort=

 

               It still gave the 502/Bad gateway

 

2 ### Changing the proxy to refer to https directly

( Because if I navigate to the http url (as written in the original web.xml) with my browser it redirects to the https variant. So I thought maybe the servlet doesn’t cope with the redirct. )

Changed

Jetty9.4\demo-base\webapps\javadoc-proxy.war\WEB-INF\web.xml

To refer to

https://www.eclipse.org/jetty/javadoc/

Instead of http://,  Now when I access the demo-base  Javadoc link then, I get this:

HTTP ERROR 500

Problem accessing /proxy/current/. Reason:

    Server Error

Caused by:

java.lang.NullPointerException: Missing SslContextFactory

  at java.util.Objects.requireNonNull(Objects.java:228)

  at org.eclipse.jetty.io.ssl.SslClientConnectionFactory.<init>(SslClientConnectionFactory.java:55)

  at org.eclipse.jetty.client.HttpClient.newSslClientConnectionFactory(HttpClient.java:1170)

  at org.eclipse.jetty.client.HttpDestination.newSslClientConnectionFactory(HttpDestination.java:137)

  at org.eclipse.jetty.client.HttpDestination.<init>(HttpDestination.java:94)

  at org.eclipse.jetty.client.PoolingHttpDestination.<init>(PoolingHttpDestination.java:25)

  at org.eclipse.jetty.client.http.HttpDestinationOverHTTP.<init>(HttpDestinationOverHTTP.java:32)

  at org.eclipse.jetty.client.http.HttpClientTransportOverHTTP.newHttpDestination(HttpClientTransportOverHTTP.java:51)

  at org.eclipse.jetty.client.HttpClient.destinationFor(HttpClient.java:542)

  at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:575)

  at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:726)

  at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:718)

  at org.eclipse.jetty.proxy.AbstractProxyServlet.sendProxyRequest(AbstractProxyServlet.java:561)

  at org.eclipse.jetty.proxy.ProxyServlet.service(ProxyServlet.java:119)

 

 

 

Regards

 

 

From: jetty-users-bounces@xxxxxxxxxxx <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Houtman, Roland
Sent: Friday, July 19, 2019 9:43 AM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] ProxyServlet$Transparent returns 502 for external sites

 

Thanks,

 

I downloaded Jetty latest 9.4, ran the demo-base and was looking around,

Then I found that the transparent-proxy is used for redirecting to the online Javadoc

               Localhost:8080/proxy/current

 

So, I click it and I also get “502 bad gateway”

 

Is there some logging which I can pick up to see why the remote site returns 502?

 

 

Kind regards

 

 

From: jetty-users-bounces@xxxxxxxxxxx <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Joakim Erdfelt
Sent: Thursday, July 18, 2019 7:29 PM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] ProxyServlet$Transparent returns 502 for external sites

 

Start by upgrading your version of Jetty, and try again.

 

Version 9.0 was an experimental / transitional release series between Servlet 3.0 (Jetty 8) and 3.1 (Jetty 9).

That series has been EOL (End of Life) for a long time. (many years now)

 


Joakim Erdfelt / joakim@xxxxxxxxxxx

 

 

On Thu, Jul 18, 2019 at 11:50 AM Houtman, Roland <Roland.Houtman@xxxxxxxxxxxxxxx> wrote:

Hi,

 

I’m trying to use the ProxyServlet$Transparent

So far I am succeeding when proxying HTTP requests to my local GeoServer

 

But when I proxy to a www URL, then I get 502 bad gateway on two separate servers.

 

I’m working from office, so I do work behind a proxy.

What are things I can check to come closer to fixing this issue?

 

I listed the test URLS in the web.xml for reference and minimal-test-setup

Using jetty-9.0.7.v20131107

 

Kind regards,

Roland

 

 

 

 

 

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top