Devforth team developed SPA-to-HTTP adapter for Traefik

development software
Devforth team developed SPA-to-HTTP adapter for Traefik

At the end of May this year, the Devforth team developed a solution that allows serving Single Page Applications (SPA) using Traefik HTTP proxy. Traefik (pronounced traffic) is a modern open-source HTTP reverse proxy and load balancer and is often considered a replacement for russian-made Nginx.

Nowadays, more and more companies are refusing to use software developed by russians. There are different reasons, such as possible collaboration with FSB (allegedly Kaspersky Lab and vKontakte), supporting the russian invasion of Ukraine (Avito), or, like in this case - using russian-made software and mentioning this country in positive key might indirectly lead to their profits, which is unacceptable.

Traefik is a popular solution with many benefits compared to Nginx, which is still widely used.

Benefits of Traefik:

  • the simplicity of installation and maintenance;
  • can be quickly started without configs (you can use docker labels on containers to set up routing);
  • has powerful Docker/K8S integration;
  • has a built-in web dashboard;
  • supports Let’s Encrypt with no need to install additional modules;
  • is created by non-russians, so you don’t support the aggressor even indirectly.

The only one flaw in comparison is that Traefik doesn’t have native support for static file serving. So, the Devforth team developed a lightweight image, written in Go, that is compatible with most common setups, easily configurable, and is available under the MIT license on GitHub, allowing you to use it in commercial projects. Also, the benefits of this solution include:

  • small binary size;
  • no overhead on runtime (because of code written in Go);
  • compatibility with all popular Single Page Application frameworks and libraries, such as Angular, React, Vue, and bundlers (Webpack/Vite);
  • pre-configured statics caching (no-cache on index.html file to auto-update caches and infinite max-age for all other resources with hash-URLs in all SPA frameworks).