New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking 鈥淪ign up for GitHub鈥, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inlining fonts behind HTTP proxy #19401
Comments
|
This is affecting me as well. Our build servers don't have access outside our firewalls. I guess turning it off, is our only option. |
|
On how to disable this, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration |
|
Had the same issue behind a corporate proxy. Thought of using an index.html referencing the google fonts in dev config and replacing the index.html with a prod version referencing a local copy of the fonts that would be made in the build procedure of my docker image in my pipeline. However, this would have required additional scripting for the woff2 files referenced in the css files. I ended up using fontsource. This way |
Why not just disable font optimization? |
|
If I set ONLY fonts optimization to false are scripts and styles property set to false or are they still true by default ? I am not able to find any info on this. Could someone help ? |
|
They are |
|
Yeah, if you think about the code behind that property, the type is likely a simple boolean or some optimization config interface. Defining it as a simple boolean true is the equivalent of setting it with an object that has all properties as true. So if you want to just turn off one, provide an object that has all true, but the one(s) you want turned off as false. Seems pretty straightforward. |
With this change users can now their proxy server via the `HTTPS_PROXY` environment variable. The specified proxy will be used when making requests to inline fonts. Closes #19401
|
This is the new error I get with the patch. I have tried with hardcoding my proxy credentials into %HTTP_PROXY% and %HTTPS_PROXY% too, but still no luck. 脳 Index html generation failed.
Inlining of fonts failed. An error has occurred while retrieving https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap over the internet.
Socket is closedAngular CLI: 11.1.2
Node: 14.15.1
OS: win32 x64
Angular: 11.1.1
...
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1101.2
@angular-devkit/build-angular 0.1101.2
@angular-devkit/core 11.1.2
@angular-devkit/schematics 11.1.2
@angular/cli 11.1.2
@angular/flex-layout 11.0.0-beta.33
@schematics/angular 11.1.2
@schematics/update 0.1101.2
rxjs 6.6.3
typescript 4.0.5 |
|
@alexaka1, are you using a rotating proxy?, If so, can you try using Node.js 12? |
|
Edit: Although something has changed here, because now even node 14 doesn't give the error, but this, regardless of what I have in the Original comment: @alan-agius4 No we don't have rotating proxy, but still I have installed nvm4w, and got Node 12.20.1 installed, and building with that no cmd error is given, however, the final <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<!-- FileName:index.html Language:[en]--><!--Head--><head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>McAfee Web Gateway - Notification</title>
<script
src="/mwg-internal/de5fs23hu73ds/files/javascript/sw.js"
type="text/javascript"
></script>
<link
rel="stylesheet"
href="/mwg-internal/de5fs23hu73ds/files/default/stylesheet.css"
/></head
><!--/Head--><!--Body-->
<body onload="swOnLoad();">
<table class="bodyTable">
<tr>
<td
class="bodyData"
background="/mwg-internal/de5fs23hu73ds/files/default/img/bg_body.gif"
>
<!--Logo-->
<table class="logoTable">
<tr>
<td class="logoData">
<a href="http://www.mcafee.com">
<img
src="/mwg-internal/de5fs23hu73ds/files/default/img/logo_mwg.png"
/></a>
</td>
</tr>
</table>
<!--/Logo--><!--Contents--><!-- FileName:authenticationrequired.html Language:[en]--><!--Title-->
<table
class="titleTable"
background="/mwg-internal/de5fs23hu73ds/files/default/img/bg_navbar.jpg"
>
<tr>
<td class="titleData">Authentication Required</td>
</tr>
</table>
<!--/Title--><!--Content-->
<table class="contentTable">
<tr>
<td class="contentData">
You must be authenticated to access this URL.
</td>
</tr>
</table>
<script language="javascript" type="text/javascript">
urlprotocol = "https";
statuscode = 407;
if (statuscode == 401 && urlprotocol == "ftp") {
document.write('<form name="ftpform" method="get" action="">');
document.write('<table class="contentData">');
document.write(
'<tr><td class="contentData" colspan=2>Please enter your credentials in the form below and click "Access FTP" button if your browser doesn\'t present authentication promt for FTP sites.</td></tr>'
);
document.write(
'<tr><td class="contentData">Username:</td><td><input type="text" id="ftpUsername" name="ftpUsername" size=40 /></td></tr>'
);
document.write(
'<tr><td class="contentData">Password:</td><td><input type="password" id="ftpPassword" name="ftpPassword" size=40 /></td></tr>'
);
document.write(
'<tr><td class="contentData" colspan=2 align=center><input type="button" onclick="redirectToFTP();" value="Access FTP" /></td></tr>'
);
document.write("</table>");
document.write("</form>");
}
function redirectToFTP() {
var username = escape(
document.getElementById("ftpUsername").value
);
var password = escape(
document.getElementById("ftpPassword").value
);
location.href =
"ftp://" +
username +
":" +
password +
"@fonts.googleapis.com:443";
}
</script>
<!--/Content--><!--Info-->
<table class="infoTable">
<tr>
<td class="infoData">
<b>URL:</b>
<script type="text/javascript">
break_line("https://fonts.googleapis.com");
</script>
<br />
</td>
</tr>
</table>
<!--/Info--><!--/Contents--><!--Policy-->
<table class="policyTable">
<tr>
<td class="policyHeading">
<hr />
Company Acceptable Use Policy
</td>
</tr>
<tr>
<td class="policyData"></td>
</tr>
</table>
<!--/Policy--><!--Foot-->
<table class="footTable">
<tr>
<td
class="helpDeskData"
background="/mwg-internal/de5fs23hu73ds/files/default/img/bg_navbar.jpg"
>
For assistance, please contact your system administrator.
</td>
</tr>
<tr>
<td class="footData">
generated <span id="time">2021-02-01 15:52:39</span> by
webgateway1 <br />
<br />
#Authentication with Kerberos and NTLM Fallback / Perform
Authentication
</td>
</tr>
</table>
<!--/Foot-->
</td>
</tr>
</table>
</body>
<!--/Body-->
</html> |
|
@alexaka1, it appears that the authentication is failing, are you providing the credentials as part of the proxy uri specified in From the HTML page above, it appears that the proxy returned a 407, which indicates that proxy authentication is required. I have a fix, so that such errors thrown in the terminal. |
|
@alan-agius4 Yes I have tried providing credentials in |
|
HTTPS over HTTP proxy shouldn't be a problem at all. That is a common case. If you are using AD, you do need to provide the domain name of the authentication server, in the following format. If you do have special characters in your password, indeed most likely you do need to use encoding, both HEX or URL encode should do the trick. |
|
@alan-agius4 I have tried the above, and I get strange behaviour. When I add a domain, even npm breaks, and it can't reach the registry. ng build gives this error: 脳 Index html generation failed.
Inlining of fonts failed. An error has occurred while retrieving https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap over the internet.
getaddrinfo ENOTFOUND mydomain
If I don't add a domain, but change my password to a wrong one, then npm works fine. Edit: I have figured out the proxy gateways use their own domain, if I use that I get: |
|
|
@alan-agius4 I ended up using @fontsource too to host the fonts locally. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |


Command (mark with an
x)Is this a regression?
No
Description
Since 11.0.0 there is the new feature to inline fonts. The problem is that it does not work behind HTTP proxy. We have correctly set
HTTP_PROXY/http_proxyandNO_PROXY/no_proxyenvironment variables, but it is ignored.There is no support for proxy:
angular-cli/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts
Line 107 in 871dd6a
There is not really a reproduction scenario. It fails only when running behind HTTP proxy.
Anything else relevant?
The text was updated successfully, but these errors were encountered: