Code Monkey home page Code Monkey logo

Comments (4)

dougmoscrop avatar dougmoscrop commented on July 21, 2024

Youre suggesting that we should not ask about binary if there's no content type?

from serverless-http.

huksley avatar huksley commented on July 21, 2024

Currently, 304 requests processed wrong, responses have application/json Content-Type?
Anyways I resorted into disabling etag in ExpressJS, resulting in no If-modified-Since sent by browser.

I think If-Modified-Since must be handled differently. Of course binary must be called only if ExpressJS actually give out body in handler.

// Disable 304 support, works wrong IMO
app.set('etag', false);
// Always send last-modified as current time
app.get('/*', function(req, res, next){ 
  res.setHeader('Last-Modified', (new Date()).toUTCString());
  next(); 
});

https://github.com/huksley/todo-react-ssr-serverless/

from serverless-http.

huksley avatar huksley commented on July 21, 2024

Just a thought...
Maybe we can do the following:

  • by utilizing serverless-webpack, gather all links to static resources (imported)
  • gather all static resources in public/ and other folders
  • deploy them to S3 public bucket
  • for every resource, define API GW proxy endpoint during deploy

This way, all static resources will be handled by S3 bucket

image

P.S. best way is to skip API GW entirely and serve them from S3 bucket/CDN directly

from serverless-http.

dougmoscrop avatar dougmoscrop commented on July 21, 2024

I mean yeah that sounds like something that could be a serverless plugin - it's def. out of scope for this library.

For the content-type stuff, it's always good to just set up an express app first and verify how it behaves, on its own.

from serverless-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.