Skip to content

nginx SSI #26

Description

@tselishev-semen

First of all, the idea is very smart. Really enjoyed reading it.

I have a small question though regarding an env-config.js. Why did you prefer this solution over Nginx SSI for example? When you create a small HTML template (using SSI) with injected JSON inside, like this:

<script type="application/​json" id="env-config">
{
  "API_URL": ""https://..."
}
</script>

and then just inject this template into index.html.

It looks like this way you can optimize the performance of the app and resolve some issues with the cache.

  1. It will avoid an extra request to env-config.js since all data will be already inside index.html - no extra Round Trip for the very first-page loading
  2. No need for cache busting approach for env-config.js, since you can just clean cache on the CDN for your index.html when you need to change something. It's possible because HTML files are cached differently than js scripts and have minimum cache time or don't have it at all.

I used to use a similar approach, but using NGINX SSI looks like a superior solution :) Probably I'm missing something, so I would really appreciate your comment on that

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions