2

What are the options for service polymer es6-bundle,es5-bundle and unbundled versions conditionally ?

preferred option would be nginx if that's possible, so basically how to detect HTTP2 and if there's good regex for user agent to detect es6

MySqlError
  • 620
  • 8
  • 20

1 Answers1

2

i have found next solution:

On backend you should define map like so:

map $cookie_build $assets_suffix {
    ""    "";
    "no"             "";
    "es6-bundled"    "build/es6-bundled/";
    "es6-unbundled"  "build/es6-unbundled/";
    "es5-bundled"    "build/es5-bundled/";
}

and polymer's assets location define something like this

location /polymer-app/ {
    alias /app/public/frontend/$assets_suffix;
    try_files $uri $uri/ /polymer-app/index.html;
}

so, by default, nginx serves development build, and when there is defined cookie for build version it serves appropriate build of application.

On clientside

You should detect browser capabilities for example using this gist https://gist.github.com/DaBs/89ccc2ffd1d435efdacff05248514f38 or by any other feature-detect-* library Then you should set corresponding cookie and call window.location.reload(true).

In my case, i have a separate landing page based on cms, so browser detection processed on it and when user hits application, corresponding cookie is already set.

  • There is one more solution based on user-agent matching https://gitlab.techcultivation.org/sangha/sangha-frontend/issues/6 – Dmitriy Nikitin Aug 22 '17 at 07:52
  • 1
    that's great, although I ended up using https://github.com/Polymer/prpl-server-node with nginx as reverse proxy – MySqlError Apr 16 '18 at 16:58