After installation, cannot create new CUBA project (apparently Java proxy problem)

We are currently trying out the great CUBA Platform

However, we cannot choose platform version in the “Platform version” drop-down list.

We are behind proxy which requires basic HTTP authentication?

May I ask what is the proper way to use CUBA Studio Platform when behind HTTP proxy which requires Basic HTTP authentication?

The versions are as follows:

CUBA Studio SE v6.8.6
JDK v1.8.0_171

Already uncommented the following lines in “net.properties” under JDK_folder\jre\lib:

jdk.http.auth.proxying.disabledSchemes=
jdk.http.auth.tunneling.disabledSchemes=

The JAVA_OPTS system environment variable has also been set:

-Djdk.http.auth.tunneling.disabledSchemes= -Djdk.http.auth.proxying.disabledSchemes= -Dhttps.proxyHost=proxy_hostname -Dhttps.proxyPort=8080 -Dhttps.proxyUser=user123 -Dhttps.proxyPassword=pass123

The following warning was shown in “studio.log”:

2018-05-29 10:21:01,451 WARN [com.haulmont.studio.backend.pm.BaseProjectsRepo] Error loading base projects group platform from the repository: java.io.IOException: Unable to tunnel through proxy. Proxy returns “HTTP/1.1 407 Proxy Authorization Required”

The following stream to HTTP proxy was capture using Wireshark:

(Note: there is no Proxy-Authorization header is sent in the request)

(May I ask what is the proper way to use CUBA Studio Platform when behind HTTP proxy which requires Basic HTTP authentication?)

CONNECT repo.cuba-platform.com:443 HTTP/1.1
User-Agent: Java/1.8.0_171
Host: repo.cuba-platform.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, /; q=.2
Proxy-Connection: keep-alive

HTTP/1.1 407 Proxy Authorization Required
Date: Tue, 29 May 2018 02:14:10 GMT
Proxy-Connection: keep-alive
Via: 1.1 <…proxy_hostname removed…>
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Proxy-Authenticate: Basic realm=“Websense Content Gateway”
Content-Length: 666

<…removed for clarity…>

Try to test the proxy using the attached file.

Thank you for your professional assistance. I tried to invoke the testing program:

run.bat

which is equivalent to the following

java -Djdk.http.auth.tunneling.disabledSchemes= -Djdk.http.auth.proxying.disabledSchemes= -Dhttps.proxyHost=proxy_hostname -Dhttps.proxyPort=8080 -Dhttps.proxyUser=user123 -Dhttps.proxyPassword=pass123 -cp .\out\production\repo-access-test repo_test.Main

The console prints the following error with stack trace:

Exception in thread “main” java.io.IOException: Unable to tunnel through proxy.
Proxy returns "HTTP/1.1 407 Proxy Authorization Required"
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(Unknown Sourc
e)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown S
ource)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
urce)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unkn
own Source)
at repo_test.Main.main(Main.java:24)

Furthermore, the connection to HTTP proxy was captured using Wireshark too. There is again no Proxy-Authorization header is sent in the request, which is likely the root cause of Error 407.

Lastly, for your information, the version of JDK is JDK v1.8.0_171.

Can you configure your proxy then try to disable the proxy authentication?

This is my JAVA_OPTS on environment variables.

2018-05-30 09_24_26-Untitled - Notepad

Hi, Earl02, this is a corporate proxy and proxy authentication (Basic) is enforced. Therefore, when I attempt to use your suggested JAVA_OPTS, it does not work because the Java program has to include the Proxy-Authorization in the request in order to make it works.

Can you try JAVA_OPTS on http only?

-Dhttp.proxyHost=proxyhostURL
-Dhttp.proxyPort=proxyPortNumber
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword

Sure. For http-only JAVA_OPTS, it results in the following:

Exception in thread “main” java.net.UnknownHostException: repo.cuba-platform.com

    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    <...removed for clarity....>

Can you try JAVA_OPTS on http & https?

-Dhttp.proxyHost=proxyhostURL
-Dhttp.proxyPort=proxyPortNumber
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword

-Dhttps.proxyHost=proxyhostURL
-Dhttps.proxyPort=proxyPortNumber
-Dhttps.proxyUser=someUserName
-Dhttps.proxyPassword=somePassword

Even if both are included in JAVA_OPTS, the same HTTP Error 407 appears:

Exception in thread “main” java.io.IOException: Unable to tunnel through proxy.
Proxy returns “HTTP/1.1 407 Proxy Authorization Required”

Can you access this web site on your browser using proxy?

Capture

Yes, when accessing through browser, it works like a charm:

image

So the problem is between the java to the https proxy. We need the power of the dev on this. Hopefully they will reply :slight_smile:

Anyway, thank you for your kind help up to now!!

I really wish the CUBA developers can provide assistance since we are considering and evaluating various RAD platforms suitable for our use.

Hi @twlaid

We will test the work behind proxy requiring authentication as soon as we set up the test environment for this. It’ll take some time.

Hi @twlaid,
We have reproduced the problem.
Studio could not download some required files when working behind a proxy with required authorization.

We have created a YouTrack issue. We are going to fix is soon.
Thank you.

Thank you very much for your assistance. I am looking forward to your update soon! Thank you!

A post was split to a new topic: Proxy settings in UI

Hi,
We have fixed the problem with proxy authorization.
The fix will be delivered in the next Studio release, which is planned on the middle of the next week.

Now you can work behind a proxy using snapshot of Studio SE.

Adjust the following JAVA_OPTS in your system. The last is required.

set JAVA_OPTS=%JAVA_OPTS% "-Dhttp.proxyHost=192.168.xx.xxx" "-Dhttp.proxyPort=xxxx" "-Dhttp.proxyUser=proxyuser" "-Dhttp.proxyPassword=proxypassword" "-Dhttps.proxyHost=192.168.xx.xxx" "-Dhttps.proxyPort=xxxx" "-Dhttps.proxyUser=proxyuser" "-Dhttps.proxyPassword=proxypassword" "-Djdk.http.auth.tunneling.disabledSchemes="

1 Like