Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

async doesn't work when I use with gzip compression in express #264

Open
WarisR opened this issue Oct 10, 2018 · 7 comments
Open

async doesn't work when I use with gzip compression in express #264

WarisR opened this issue Oct 10, 2018 · 7 comments

Comments

@WarisR
Copy link

WarisR commented Oct 10, 2018

In index.js(Node.js), I use express and I add compression middleware to do a gzip compression

const app = express();
app.use(compression());
app.get(['/', '/index'], (req, res) => {
  req.url = req.originalUrl === '/' ? '/index' : req.originalUrl;
  tailor.requestHandler(req, res);
});

index.html

<fragment src="http://localhost:3000" async></fragment>

I added async in index.html but it doesn't work properly and still load synchronously.

Does Async in Tailor support gzip compression? Anyone has a workaround?

@vigneshshanmugam
Copy link
Collaborator

All the fragments supports gzip compression, There is no differentiation between sync and async fragments except async fragments are streamed later on the page.

@trickpeeraze
Copy link

I think he mean by the Tailor itself that doesn't support compression, not fragments.

@WarisR
Copy link
Author

WarisR commented Nov 1, 2018

@vigneshshanmugam Yes, I meant the Tailor doesn't work property with async+compression. It would wait all fragments loaded before render in the browser even if we use async.

@WarisR
Copy link
Author

WarisR commented Nov 19, 2018

@vigneshshanmugam Do you compress your website (Tailor level not a fragment level) by nginx/express/etc.?
I use this library for compression. https://github.com/expressjs/compression and also try Nginx. It doesn't work with async.

@vigneshshanmugam
Copy link
Collaborator

We do compress it using our in house proxy server Skipper. I am not sure why it doesn't work with compression. I will try to check and update you.

@WarisR
Copy link
Author

WarisR commented Dec 6, 2018

@vigneshshanmugam Thank you. Do you suggest me to use Skipper? Is only Tailor is enough for production?

@vigneshshanmugam
Copy link
Collaborator

@WarisR Sorry somehow lost your message. Tailor is indeed enough for handling the load for production. But since GZIP is a CPU heavy task, I would say its better to do it at the proxy level like using Skipper/Nginx etc .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants