Deployed app engine isn't gzipping my content
Final update
Should be rolling out end of this month.
Pretty odd here, I have deployed a few sites to app engine on standard env NodeJS. It's late but hopefully I've been doing something wrong.
I have a base scaffold Angular 6 app that I've deployed to app engine, and while the locally ran server is giving me gzipped content, the deployed app is not. Pretty standard universal server.ts
:
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import * as express from 'express';
import compression from 'compression';
import { enableProdMode } from '@angular/core';
import { join } from 'path';
enableProdMode();
const app = express();
app.use(compression()); // <== Definitely using compression here
const PORT = process.env.PORT || 8080;
const DIST_FOLDER = join(process.cwd(), 'dist');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {
AppServerModuleNgFactory,
LAZY_MODULE_MAP
} = require('./dist/server/main');
// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
app.engine(
'html',
ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [provideModuleMap(LAZY_MODULE_MAP)]
})
);
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));
// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
// All regular routes use the Universal engine
app.get('*', (req, res) => {
res.render('index', { req });
});
// Start up the Node server
app.listen(PORT, () => {
console.log(`Node server listening on http://localhost:${PORT}`);
});
Devtools for the deployed site is showing both full file size and the response headers are not "gzip", although the accept-encoding is the usual gzip, br
etc.
Locally, it's gzipped.
I'm stumped.
Edit:
Just as a bump, I made a very basic application to show the issue. I've read all the docs, and I just really don't get why, if anything, the express middleware is not being "allowed" to serve the gzipped content via the compression
middleware.
Request headers for the largest asset:
:authority: ng-universal-test-220902.appspot.com
:method: GET
:path: /main.119034af43b36e354210.js
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
pragma: no-cache
referer: https://ng-universal-test-220902.appspot.com/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36
Response headers for the same request:
accept-ranges: bytes
alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
cache-control: public, max-age=0
content-length: 642804
content-type: application/javascript; charset=UTF-8
date: Mon, 29 Oct 2018 02:26:38 GMT
etag: W/"9cef4-166bda0e164"
last-modified: Mon, 29 Oct 2018 02:22:09 GMT
server: Google Frontend
status: 200
vary: Accept-Encoding
x-cloud-trace-context: 8d126079c95f2e6bbced4265c46a87ca
x-powered-by: Express
angular express google-app-engine
add a comment |
Final update
Should be rolling out end of this month.
Pretty odd here, I have deployed a few sites to app engine on standard env NodeJS. It's late but hopefully I've been doing something wrong.
I have a base scaffold Angular 6 app that I've deployed to app engine, and while the locally ran server is giving me gzipped content, the deployed app is not. Pretty standard universal server.ts
:
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import * as express from 'express';
import compression from 'compression';
import { enableProdMode } from '@angular/core';
import { join } from 'path';
enableProdMode();
const app = express();
app.use(compression()); // <== Definitely using compression here
const PORT = process.env.PORT || 8080;
const DIST_FOLDER = join(process.cwd(), 'dist');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {
AppServerModuleNgFactory,
LAZY_MODULE_MAP
} = require('./dist/server/main');
// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
app.engine(
'html',
ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [provideModuleMap(LAZY_MODULE_MAP)]
})
);
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));
// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
// All regular routes use the Universal engine
app.get('*', (req, res) => {
res.render('index', { req });
});
// Start up the Node server
app.listen(PORT, () => {
console.log(`Node server listening on http://localhost:${PORT}`);
});
Devtools for the deployed site is showing both full file size and the response headers are not "gzip", although the accept-encoding is the usual gzip, br
etc.
Locally, it's gzipped.
I'm stumped.
Edit:
Just as a bump, I made a very basic application to show the issue. I've read all the docs, and I just really don't get why, if anything, the express middleware is not being "allowed" to serve the gzipped content via the compression
middleware.
Request headers for the largest asset:
:authority: ng-universal-test-220902.appspot.com
:method: GET
:path: /main.119034af43b36e354210.js
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
pragma: no-cache
referer: https://ng-universal-test-220902.appspot.com/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36
Response headers for the same request:
accept-ranges: bytes
alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
cache-control: public, max-age=0
content-length: 642804
content-type: application/javascript; charset=UTF-8
date: Mon, 29 Oct 2018 02:26:38 GMT
etag: W/"9cef4-166bda0e164"
last-modified: Mon, 29 Oct 2018 02:22:09 GMT
server: Google Frontend
status: 200
vary: Accept-Encoding
x-cloud-trace-context: 8d126079c95f2e6bbced4265c46a87ca
x-powered-by: Express
angular express google-app-engine
add a comment |
Final update
Should be rolling out end of this month.
Pretty odd here, I have deployed a few sites to app engine on standard env NodeJS. It's late but hopefully I've been doing something wrong.
I have a base scaffold Angular 6 app that I've deployed to app engine, and while the locally ran server is giving me gzipped content, the deployed app is not. Pretty standard universal server.ts
:
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import * as express from 'express';
import compression from 'compression';
import { enableProdMode } from '@angular/core';
import { join } from 'path';
enableProdMode();
const app = express();
app.use(compression()); // <== Definitely using compression here
const PORT = process.env.PORT || 8080;
const DIST_FOLDER = join(process.cwd(), 'dist');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {
AppServerModuleNgFactory,
LAZY_MODULE_MAP
} = require('./dist/server/main');
// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
app.engine(
'html',
ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [provideModuleMap(LAZY_MODULE_MAP)]
})
);
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));
// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
// All regular routes use the Universal engine
app.get('*', (req, res) => {
res.render('index', { req });
});
// Start up the Node server
app.listen(PORT, () => {
console.log(`Node server listening on http://localhost:${PORT}`);
});
Devtools for the deployed site is showing both full file size and the response headers are not "gzip", although the accept-encoding is the usual gzip, br
etc.
Locally, it's gzipped.
I'm stumped.
Edit:
Just as a bump, I made a very basic application to show the issue. I've read all the docs, and I just really don't get why, if anything, the express middleware is not being "allowed" to serve the gzipped content via the compression
middleware.
Request headers for the largest asset:
:authority: ng-universal-test-220902.appspot.com
:method: GET
:path: /main.119034af43b36e354210.js
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
pragma: no-cache
referer: https://ng-universal-test-220902.appspot.com/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36
Response headers for the same request:
accept-ranges: bytes
alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
cache-control: public, max-age=0
content-length: 642804
content-type: application/javascript; charset=UTF-8
date: Mon, 29 Oct 2018 02:26:38 GMT
etag: W/"9cef4-166bda0e164"
last-modified: Mon, 29 Oct 2018 02:22:09 GMT
server: Google Frontend
status: 200
vary: Accept-Encoding
x-cloud-trace-context: 8d126079c95f2e6bbced4265c46a87ca
x-powered-by: Express
angular express google-app-engine
Final update
Should be rolling out end of this month.
Pretty odd here, I have deployed a few sites to app engine on standard env NodeJS. It's late but hopefully I've been doing something wrong.
I have a base scaffold Angular 6 app that I've deployed to app engine, and while the locally ran server is giving me gzipped content, the deployed app is not. Pretty standard universal server.ts
:
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import * as express from 'express';
import compression from 'compression';
import { enableProdMode } from '@angular/core';
import { join } from 'path';
enableProdMode();
const app = express();
app.use(compression()); // <== Definitely using compression here
const PORT = process.env.PORT || 8080;
const DIST_FOLDER = join(process.cwd(), 'dist');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {
AppServerModuleNgFactory,
LAZY_MODULE_MAP
} = require('./dist/server/main');
// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
app.engine(
'html',
ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [provideModuleMap(LAZY_MODULE_MAP)]
})
);
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));
// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
// All regular routes use the Universal engine
app.get('*', (req, res) => {
res.render('index', { req });
});
// Start up the Node server
app.listen(PORT, () => {
console.log(`Node server listening on http://localhost:${PORT}`);
});
Devtools for the deployed site is showing both full file size and the response headers are not "gzip", although the accept-encoding is the usual gzip, br
etc.
Locally, it's gzipped.
I'm stumped.
Edit:
Just as a bump, I made a very basic application to show the issue. I've read all the docs, and I just really don't get why, if anything, the express middleware is not being "allowed" to serve the gzipped content via the compression
middleware.
Request headers for the largest asset:
:authority: ng-universal-test-220902.appspot.com
:method: GET
:path: /main.119034af43b36e354210.js
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
pragma: no-cache
referer: https://ng-universal-test-220902.appspot.com/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36
Response headers for the same request:
accept-ranges: bytes
alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
cache-control: public, max-age=0
content-length: 642804
content-type: application/javascript; charset=UTF-8
date: Mon, 29 Oct 2018 02:26:38 GMT
etag: W/"9cef4-166bda0e164"
last-modified: Mon, 29 Oct 2018 02:22:09 GMT
server: Google Frontend
status: 200
vary: Accept-Encoding
x-cloud-trace-context: 8d126079c95f2e6bbced4265c46a87ca
x-powered-by: Express
angular express google-app-engine
angular express google-app-engine
edited Nov 20 '18 at 23:41
asked Oct 11 '18 at 4:14
Phix
4,42621845
4,42621845
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
According to the issue tracker, this will roll out end of November.
Update
It looks like this has been rolled out. You can see an example application created to track this here.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52752100%2fdeployed-app-engine-isnt-gzipping-my-content%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
According to the issue tracker, this will roll out end of November.
Update
It looks like this has been rolled out. You can see an example application created to track this here.
add a comment |
According to the issue tracker, this will roll out end of November.
Update
It looks like this has been rolled out. You can see an example application created to track this here.
add a comment |
According to the issue tracker, this will roll out end of November.
Update
It looks like this has been rolled out. You can see an example application created to track this here.
According to the issue tracker, this will roll out end of November.
Update
It looks like this has been rolled out. You can see an example application created to track this here.
edited Nov 29 '18 at 18:19
answered Nov 20 '18 at 20:35
Phix
4,42621845
4,42621845
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52752100%2fdeployed-app-engine-isnt-gzipping-my-content%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown