There’s an issue with this code. The regex doesn’t compile:
WebApp.rawConnectHandlers.use(function(req, res, next) {
// this is the problematic line:
if (req._parsedUrl.pathname.match(/\.(ttf|ttc|otf|eot|woff|font\.css|css)$/) {
res.setHeader('Access-Control-Allow-Origin', /* your hostname, or just '*' */);
}
next();
});
Sadly my regex is not strong and I’m not sure what the issue is.
Another issue I’ve just run into while using the CDN is the option to have a fallback to the regular site if the CDN doesn’t load the file properly.
If you have a site with 25 servers and you do an update, it will take a while to update all of them. If someone then comes to the site during the update and Amazon tries to fetch the JS for the site from your domain it might not be able to retrieve it. It depends on what Meteor instance Cloudfront connects to as to which files will be available.
This also happens if you only try to update the code for some servers, but not all of them. I think I’ll post this in its own topic now.
Any idea what has changed in deploying apps in meteor 1.4? I recently updated my app from 1.2.1 to latest meteor and all JS files are not bundled to together after deployment.
meteor deploy --architecture os.linux.x86_64
copy bundle to server
meteor npm install in /programs/server folder
node main.js
Before I got nicely bundled CSS and JS files but now I have JS file for every package.
Thanks for the reply. I noticed they are talking about minifying server side code. In my case all the client side code is not bundled together. I have verified that other meteor sites are serving single js and css file to browser so there must be something wrong with the way I deployed my app.
I see. I haven’t seen this happening. I’m afraid I can’t help with this one other than by suggesting to reinstall Meteor. Though it would be good to trace back to the real cause in case it’s a bug.
I think a good option would be to create a new app, and see if it still happens. If it works well for a new app, then there is probably something about that specific application. I would try to make the application simpler and simpler until the issue doesn’t happen anymore, that will help isolate the cause. Reinstalling Meteor is unlikely to help.
That’s a very sensible suggestion, @sashko . Actually the best course of action. @jarski mentions updating the app from 1.2.1 to 1.4, without saying anything about changing the app code. My rationale was that, in this case the nuclear option would be best to try first, as it only takes a few minutes and there’s a slight chance it might save you all the tedious steps. I’ve seen meteor-tool getting corrupted once or twice in the past, after botched download attempts.
And now that I looked twice: why meteor npm install and not npm install?
There was actually simple solution: the standard minifiers got removed for some reason during the update. Problem was solved by adding the package. Thanks for the help!
I would recommend to include a section in the documentation of Galaxy that explains how to handle file uploads. It will help out developers coming from a typical MAMP environment.