MATLAB: Do web-based workflows fail when MATLAB Web Preferences specify a web proxy that uses Basic authentication

authentificationbasicMATLABPROXYurlreadurlwrite

When I configure MATLAB Web Preferences to use a proxy with Basic authentication, then workflows that connect to web servers via HTTPS will fail.
If I use workflows that connect to web servers, such as using urlread and urlwrite, I see an error like the following:
    Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required".
The *Request Support* button in the MATLAB desktop displays a dialog box that reports "Unable to Contact MathWorks".

Best Answer

This issue is caused by a change in behaviour in Oracle's JRE 8 - described here: <http://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html>
See the section: *Disable Basic authentication for HTTPS tunneling.*
The following workaround restores the less secure proxy authentication behavior present in earlier versions of Java.  Before applying this workaround, please consult the person(s) responsible for your web proxy to determine if the following workaround is appropriate.
After you have confirmed that you want to use a proxy that uses Basic authentication, then follow these steps:
1. Close MATLAB.
2. Create or edit a java.opts file as described in the documentation here:<https://uk.mathworks.com/help/matlab/matlab_env/java-opts-file.html https://www.mathworks.com/help/matlab/matlab_env/java-opts-file.html>
3. Add this code on a separate line:
-Djdk.http.auth.tunneling.disabledSchemes=
4. Restart MATLAB.