koa-spa icon indicating copy to clipboard operation
koa-spa copied to clipboard

gzip compression

Open babnik63 opened this issue 11 years ago • 4 comments

I think this module and also any module that serve static files need some mean of compression same as other web server technologies. In IIS this feature is on by default but completely under control of the system administrator and the programmer. I think this is a feature request if there is no implementation yet.

babnik63 avatar Feb 21 '14 04:02 babnik63

This module should not be directly used as an http server in production, there should be an nginx proxy or something.

Use of nginx for gzip is quite simple:

    gzip  on;
    gzip_vary on;
    gzip_proxied any;
    gzip_types *;

    server {
      listen 80;
      server_name www.example.com;
      root /var/www/yoursite/public/;
      index index.html;
      try_files $uri @koa_spa;
      location @koa_spa {
        proxy_pass http://127.0.0.1:3333;
      }
    }

ktmud avatar Feb 21 '14 04:02 ktmud

Hi, Node.Js could be used as an independent web server, so I think such features could help Koa to be more usable and the whole stack more powerful. Isn't it a good idea to use this module a a place to host static html files?

On Fri, Feb 21, 2014 at 7:46 AM, Jesse Yang [email protected]:

This module should not be directly used as an http server in production, there should be an nginx proxy or something.

Use of nginx for gzip is quite simple:

gzip  on;
gzip_vary on;
gzip_proxied any;
gzip_types *;

server {
  listen 80;
  server_name www.example.com;
  root /var/www/yoursite/public/;
  index index.html;
  try_files $uri @koa_spa;
  location @koa_spa {
    proxy_pass http://127.0.0.1:3333;
  }
}

— Reply to this email directly or view it on GitHubhttps://github.com/ktmud/koa-spa/issues/1#issuecomment-35697824 .

Sincerely yours Babak Niknia Next Generation Solutions Co. Chief R&D Manager www.NEGSO.com

babnik63 avatar Feb 21 '14 04:02 babnik63

Actually, you can use https://github.com/koajs/compress combined with this. But I still suggest you use nginx instead.

ktmud avatar Feb 21 '14 04:02 ktmud

Thanks ;-)

babnik63 avatar Feb 21 '14 04:02 babnik63