Commit Graph

227 Commits

Author SHA1 Message Date
David Glasser
52eb41c24f In Node 6, send a 400 on HTTP parse failure
Previously we used the Node default behavior of just closing the
socket. This made it difficult for load balancers to understand if the
backend is buggy or the client request was bad (if Node is validating
something more strictly than the load balancer).

This only takes effect on Node 6; in older versions the socket is
already destroyed before the event is invoked. See
https://github.com/nodejs/node/pull/4557/ for details.
2016-12-15 14:36:49 -08:00
Andy Edwards
959eb7cc38 use connect.compress() after rawConnectHandlers 2016-09-06 09:14:13 -05:00
Ben Newman
6909c3a76b Merge branch 'devel' into release-1.4 2016-06-29 10:39:57 -04:00
Tom Coleman
4be08cb01f Publish CSS documents for autoupdate after rewriting for #7149
Previously we did not take the JsCssRewriteHook (i.e. CDN host)
into account when doing CSS-only "version-refreshable" HCP.

It is not possible on the client to rewrite CSS urls to take the
hook into account (as it is a function), so instead, we just
publish those CSS URLs post-transform.
2016-06-29 16:21:42 +10:00
Ben Newman
6fac3d2ec7 Comment about http 'finish' and (unused) 'prefinish' events. 2016-06-24 12:15:07 -04:00
Ben Newman
3d4864bc98 Make sure __meteor_runtime_config__.meteorEnv always defined.
Thanks to @tmeasday for suggesting this solution:
https://github.com/meteor/meteor/issues/6539#issuecomment-198871755

Fixes #6539.
2016-03-20 11:29:14 -04:00
Martijn Walraven
f53e0bd3a3 Add cordovaCompatibilityVersions to manifest.json
To ensure we don’t hot code push JavaScript that is incompatible with
the bundled native code, we calculate a hash based on the platform and
plugin versions.
2016-03-16 17:21:53 +01:00
Martijn Walraven
ea6951122e Prevent autoupdate from Cordova apps built with Meteor < 1.3
Not setting the Access-Control-Allow-Origin header avoids Cordova apps
built with Meteor < 1.3 from downloading manifest.json and thus blocks
autoupdate.
2016-03-16 13:59:31 +01:00
Ben Newman
40857bdaff Propagate meteorEnv subset of process.env from server to client.
Fixes #6399.
2016-03-08 19:37:57 -05:00
Zoltan Olah
3e59f7110e Merge branch 'devel' into release-1.3 2016-02-25 14:34:09 -08:00
Zoltan Olah
6cf92a266d Merge pull request #3860 from zol/ssr-hooks
POC for adding hooks to boilerplate generation for loading page and/or SSR
2016-02-25 14:23:51 -08:00
Martijn Walraven
698780b229 Add format to served manifest.json 2016-02-09 19:55:54 +01:00
Martijn Walraven
a9abeedbfe Merge branch 'devel' into release-1.3 2016-02-09 11:03:26 +01:00
Martijn Walraven
1bdaa04813 Merge pull request #6179 from mitar/webapp
Wrap connect middleware function into a Fiber
2016-02-08 10:21:11 +01:00
Martijn Walraven
fc508df990 Merge pull request #6101 from mitar/patch-25
Fixed manifest.json path on Windows
2016-02-08 10:17:34 +01:00
Martijn Walraven
aff1d4c17c Merge pull request #6060 from mitar/patch-23
Allow HTTP OPTIONS method to correctly support CORS preflight
2016-02-08 10:16:57 +01:00
Mitar
6bf646fd48 Wrap connect middleware function into a Fiber.
Fixes: #6170
2016-02-06 13:17:49 -08:00
David Greenspan
bd213e143b Print trace on error in webapp boilerplate 2016-02-05 10:18:01 -08:00
Mitar
fa9a896c7e Fixed manifest.json path on Windows. 2016-01-27 15:49:29 -08:00
Mitar
310b96d24d Allow HTTP OPTIONS method to correclty support CORS preflight. 2016-01-21 12:55:32 -08:00
Mitar
6d8240b90a Files without cache busters should not be set to cacheable. 2016-01-21 12:33:00 -08:00
Martijn Walraven
bdbdad91d3 Set hash to version when serving manifest.json 2016-01-11 12:50:54 +01:00
Martijn Walraven
ce628dfb81 ETags should be enclosed in double quotes 2016-01-11 11:14:36 +01:00
Martijn Walraven
fdebebb7ed Replace deprecated connect.utils.parseUrl() with parseurl module
As recommended in the deprecation warning, we replace
connect.utils.parseUrl() usage with using the parseurl module directly.
2016-01-08 13:24:04 +01:00
Martijn Walraven
21ee605541 Support query parameter to avoid downloading index page when a file does not exist
When downloading files during a Cordova hot code push, we need to
detect if a file is not available instead of inadvertently downloading
the default index page.
2016-01-08 13:23:50 +01:00
Martijn Walraven
0a31dabcd6 Don't set Last-Modified based on the file date
If we serve files with a Last-Modified based on the file date, this
interferes with content-based cache validation using ETag because
clients are required to take both into account.
2016-01-08 13:21:30 +01:00
Martijn Walraven
b8a17dd97f Serve non-cacheable files with a max-age of 0 instead of a day
We previously served non-cacheable files with a max-age of a day. This was done
to avoid image flickering on page reload (see #773).
As far as I can tell, image flickering still occurs because `location.reload`
always forces validation. But switching to `location.replace` means that max-age
will actually be respected, and we don't want to cache these assets for a day
because then changes would not be visible on reloads.
2016-01-08 13:21:29 +01:00
Martijn Walraven
5d501d1793 Update send and connect dependencies for webapp package
Updating send was necessary to allow disabling setting Last-Modified,
and version dependencies required updating connect as well.
2016-01-08 13:21:29 +01:00
Martijn Walraven
dac580e212 Set ETag header to asset hash if available
Previously, the ETag header was set (by `send`) to a default value based on the
inode of the file. Using the asset hash instead allows for proper conditional
requests even after redeployments.

To take advantage of content-based caching, we also have to disable the
Last-Modified header because having this set to the file date would still make
requests conditional on the most recent deployment. This requires updating the
send dependency and is done in a separate commit.

Fixes #626.
2016-01-08 13:21:29 +01:00
Michael Mason
f263ca4fea Allow middleware to set http status code
This commit allows middleware to set the status code of the http response. This will allow a server-side router to return, for example, a '404 Not Found' response. This has SEO benefits because currently search engines may index example.org/page-that-doesn't-exist because Meteor returns a 200 OK code and the normal boilerplate response body. With a proper 404 status we can still return the boilerplate to render a client side 404 template but search engines won't index the page. Instead of a hardcoded 200 response, we call res.writeHead with res.statusCode, and fallback to the default 200 code if it has not been set.
2016-01-05 11:05:53 +00:00
Mitar
53205bfcd1 Serve manifest.json file correctly for the main architecture. 2015-11-25 22:20:00 -08:00
ekatek
25f4859f54 change webapp interface to allow a function hook instead of a prefix
Add a bundledJsCssUrlRewriteHook function, which takes in a function and applies it
to the URL. Do not allow this on Cordova (handle that by just not calling it on Cordova).
Reimplement the bundledJsCssPrefix as a call to this function.
2015-11-04 17:35:22 -08:00
Eric Terpstra
412e502fa9 Allow PORT as a string if it matches named pipe pattern. Fixes #4413 2015-10-12 21:49:13 -07:00
David Glasser
a0162f27ec 404 instead of boilerplate on production JS links
Make sure the 404 is not cached. Helps with CDNs (see eg 6ff0faa).
2015-08-31 15:40:15 -07:00
David Glasser
69509bae9a Don't cache an error that is served as 200 2015-08-17 11:03:23 -07:00
Zoltan Olah
0fa555dbb1 Updates code to use dynamicHead/Body 2015-07-17 17:49:50 -07:00
Zoltan Olah
af2730277b Allows connect middleware to render content into the head and/or body of the boilerplate 2015-07-17 17:14:11 -07:00
David Glasser
1002349edb Add direct access to connect module from webapp 2015-03-05 17:12:36 -08:00
David Glasser
d4d349ca96 Don't overly escape Meteor.settings.public
Fixes #3730.

Testing Done:
Manual testing based on the report in #3730. Also confirmed that `</script>` is not a problem.

I would have added a test-packages test but there's no easy way to override Meteor.settings in test-packages.

Bugs closed: 3730

Reviewed at https://rbcommons.com/s/meteor/r/1/
2015-02-17 18:01:01 -08:00
Slava Kim
9a95c83b2a Don't use SIGUSR2 to communicate "refresh client program" from proxy to app
process. Use an ipc message instead.
2015-02-10 15:11:38 -08:00
David Glasser
7c40c3c5a6 Remove legacy proxy-binding
Also remove SIGHUP handler. This was designed for a legacy system, and
SIGHUP would be a better fit for what autoupdate currently uses SIGUSR2
for.  This includes removing some code in the ddp server to close
sockets on SIGHUP.
2015-01-29 14:03:11 -08:00
David Glasser
9023cccc28 Clean up PR 2015-01-09 15:53:49 -08:00
Tarang Patel
f319109634 Update webapp_server.js 2015-01-09 15:49:04 -08:00
Tarang Patel
5aba891199 Update webapp_server.js 2015-01-09 15:49:04 -08:00
David Glasser
096df9d62d Refactor parent pid check; drop --keepalive
This commit moves parent pid process from the webapp package to the boot
script. This means that daemonized apps without webapp will also exit
when the runner exits, if run from the runner. (For example, several
self-tests such as 'autoupdate' no longer leak node processes.) This is
controlled via the $METEOR_PARENT_PID environment variable instead of
from command line arguments, in order to make fewer assumptions about
how Meteor apps process arguments.

This also drops the old --keepalive support (which already has stopped
being used by the dev mode runner or any MDG deployment platforms).
Neither --parent-pid nor --keepalive were documented beforehand, and
--keepalive was already deprecated before 1.0.

These flags used to also incidentally trigger printing the LISTENING
line; this is now controlled by $METEOR_PRINT_ON_LISTEN.

Fixes #3315.
2015-01-05 15:48:32 -08:00
Tom Coleman
b04509389e Don’t apply the CDN prefix on cordova. #3278
Cordova serves assets directly from the device so it doesn’t make sense to hit the CDN for them. Besides it causes issues because they are served from /__cordova (on the real webserver) anyway.
2014-12-18 17:19:56 +11:00
Emily Stark
24d8fec98f Check for parent process only every few seconds.
Fixes #3252. Also probably fixes #2890, which we might have misattribued
to file watching in the tool process.
2014-12-07 09:34:45 -08:00
Emily Stark
70054e379d Use Meteor.absoluteUrl() to set ROOT_URL for cordova clients.
If we use `__meteor_runtime_config__.ROOT_URL` directly, as we were
previously, then we end up sending Cordova clients to http:// URLs even
if force-ssl is being used in the app. This is fairly bad on its own
(always sending cordova clients to http:// URLs instead of https://),
but made even worse by the fact that we don't set CORS headers on
force-ssl redirects (that is, the app breaks completely if the client
makes a DDP connection to an http:// URL for a force-ssl app).
2014-10-23 10:31:22 -07:00
Mitar
c2c92d9c44 Fixed comment. 2014-10-20 17:44:46 -07:00
Emily Stark
bb29469856 Replace runtime config regression selftest with simpler unit test 2014-10-08 14:28:24 -07:00