In this case we will configure NGINX to use a different set of HTML files for different browsers. This is required for different javascript files, especially if we want to support Internet Explorer browsers, that according to some global statistics are still being used by ~2% of of end users.
To use a different set of files, we configure the root folder according to the user agent string.
nginx.conf
...
map $http_user_agent $root {
default "/app/public/default";
"~rv:11\." "/app/public/ie";
}
server {
listen 8080;
...
The regular expression ~rv:11 will match for IE11 browsers, see the list of IE user agents here.
Then we can use the $root variable to configure the root folder of a location:
nginx.conf
...
location / {
root $root;
...
This could be further used for different user agents, and not only for IE.
Final Note
In case you're using webpack to create distribution, see this post for a method of creating different distributions for IE.
No comments:
Post a Comment