Configuring a Gateway for a Mobile App: Kong and Traefik Solutions

A mobile app loses sessions and slows down under peak loads — most often the problem is in the gateway. We configure an API Gateway for mobile traffic turnkey: we analyze bottlenecks, design routing and fault tolerance. The result is stable connections and predictable response times.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a mobile application for FEEDME
    Development of a mobile application for FEEDME
    971
  • Development of a mobile application for XOOMER
    Development of a mobile application for XOOMER
    869
  • Development of a mobile application for RHL
    Development of a mobile application for RHL
    1289
  • Development of a mobile application for ZIPPY
    Development of a mobile application for ZIPPY
    1143
  • Development of a mobile application for Affhome
    Development of a mobile application for Affhome
    1076
  • Development of a mobile application for the FLAVORS company
    Development of a mobile application for the FLAVORS company
    677

Configuring an API Gateway for a mobile app: where traffic breaks

A mobile client is the most unstable source of traffic that a backend ever sees. The phone goes into the subway, switches from Wi-Fi to LTE, the app goes to the background and comes back an hour later — and each such event breaks an established connection halfway.

At that moment the server has already done the work, but there is no one to respond to: the client is gone, and its next request arrives as a new one. That is how API Gateway configuration begins not with configuration, but with analyzing exactly where traffic breaks.

Then the avalanche effect kicks in. The client did not receive a response — so it repeats the request, often with the same operation key.

Without deduplication at the ingress, one payment turns into three, and a burst of retries after a mass reconnect takes down the bottleneck — usually the database — at exactly the moment it is needed most.

A gateway for a mobile app must suppress this at the ingress: maintain idempotency by request key, rate-limit per client rather than per IP, and not let a retry through if the first one is still in progress.

The third source of failures is version desynchronization. The user did not update right away, the old build sends requests in a format that the backend no longer understands, and instead of a clear error it gets a dropped connection.

Route versioning and an explicit contract help here: the gateway itself decides which backend version to serve for a specific client header, and cuts off incompatible requests before they reach the services.

Connection drops, retry bursts, and version desynchronization are three different classes of failures, but they are treated at a single point. Below we break down how this is closed at the gateway configuration level: timeouts, retries, idempotency, and version-based routing.

What a properly configured gateway gives a mobile product

A mobile app lives under conditions the web doesn't have: the network drops in an elevator or the subway, the device goes to sleep mid-request, and rolling out a version update on the client side stretches over weeks — the old build keeps hitting the backend until users update.

If every such request goes directly to the services, any instability in the channel turns into load on the backend: dropped connections, retries, duplicate operations.

Configuring an API Gateway moves all mobile traffic to a single entry point, and from there these problems are solved at one level rather than in each service separately.

Session stability rests on the gateway taking over token validation and refresh instead of leaving it to the app.

The client renews access via a refresh token through the gateway, without rebuilding a request to each service; when the connection drops, the retry goes with the same identifier, and the operation isn't duplicated.

For the user it looks simple: the app doesn't throw them back to the login screen after a network switch.

Backend load becomes predictable when the gateway rate-limits requests per user and device, cuts off unnecessary retries, and holds a queue during a spike. Limits are set by policy on the route, not by code inside the service, so the threshold changes without a release.

A spike after a broadcast or a network failure no longer reaches the database in full — only what passed validation gets through.

Release management relies on the same point: routing by app version, gradual rollout of a new build to a share of users, instant rollback by switching a rule.

Old versions keep working along their own routes until their share dwindles to nothing — and this removes the need to maintain compatibility across all services at once.

A single entry point also gives observability: latencies, response codes, and error rates are visible per route and client version, rather than smeared across the logs of a dozen services.

Let's break down how this is covered: which routes and policies are configured for your traffic profile, how current authorization is migrated, and what happens to already-released app versions.

Gateway options: built-in load balancer, Kong, Traefik, cloud service

Choosing an entry point for a mobile API is not a matter of taste, but a consequence of where the application lives, who manages certificates, and how often routing rules change. Below are four real options that teams choose between at the start of a project.

Option When it fits Limitations
Built-in load balancer A single cluster, simple rules, no external API consumers No fine-grained routing by headers, rate limits and authorization are handled in the application itself
Kong Plugins are needed: rate limits, keys, request transformation, analytics Requires a separate environment and maintenance, declarative configuration is harder for small teams
Traefik Dynamic routing, frequent releases, multiple environments Fewer ready-made plugins, some of the authorization logic has to be written in-house
Cloud gateway No infrastructure of your own, managed certificates and autoscaling are needed Vendor lock-in, limited control over network-level behavior

A built-in load balancer covers the basic scenario: an application behind a single cluster, a stable set of routes, minimal external integrations.

As soon as API versions for older builds of the mobile client appear, per-device rate limits, or different rules for partners, it stops coping — the logic sprawls across the application code.

Kong and Traefik solve this at the gateway level: routes, rate limits, token validation, and canary releases are described by configuration rather than edits in the services. A cloud gateway removes operational concerns but ties you to a provider.

In practice, the choice comes down to whether you are ready to maintain your own environment for the sake of flexibility — or prefer a managed service in exchange for less control.

Stages of configuring a gateway for mobile traffic

Configuring an API Gateway for a mobile application begins not with configuration, but with an inventory: which endpoints the client actually calls, which OS and build versions are still in circulation, and where traffic goes directly to the backend bypassing the gateway.

Without this stage, routing rules are written "by eye" and break on the very first release. Below is the sequence we follow in our work.

  1. Endpoint audit. We build a call map from logs and traces: method, frequency, response size, dependency on the application version. We flag deprecated routes that we keep only for old builds, and the points where the mobile client calls services directly.
  2. Routing scheme design. We lay out routes by prefixes and versions, determine what goes to the gateway and what remains internal. We fix the rules for rewriting paths and headers so that the backend doesn't have to be modified for every client release.
  3. Rules configuration. Rate limits per device and per user, timeouts, retries, caching of responses that don't change between calls. Separately — authentication rules: token verification at the entry point so that an unauthorized request doesn't reach the services.
  4. Fault tolerance testing. We run degradation scenarios: unavailability of one service, a traffic spike during a mass application update, connection loss on a mobile network. We look at what the gateway returns to the client instead of an error and how quickly it recovers after the load is removed.
  5. Observability. We set up metrics by route, the error rate and latency for each endpoint, and tracing of a request from client to service. Without this, the next incident is investigated blindly.
  6. Handover to operation. The configuration goes into the repository, changes go through review and automated rollout, not manually in production. We write the regulations: how to add a route, how to roll back a rule, who is on duty.

The order matters: rules written before the audit have to be rewritten, and fault tolerance tested after release costs more. Describe your task — we'll get back to you with an estimate and a work plan.

Configurations, schemas, and operational procedures that remain with the team

Work on the gateway ends not with launch, but with the handover of artifacts that the customer's team can use to keep things running without us. Below is what exactly remains in the repository and in the documentation.

  • Gateway configuration as declarative manifests: routes, upstreams, health checks, timeouts, and limits — all in a version control system, not in a web interface. Changes go through review and are rolled out like a regular release.
  • Routing schema with a service map: which path leads to which backend, where versioning is, where canary branches are, how rule conflicts are resolved.
  • Access policies: authentication schemes, key issuance and rotation, rate limiting by clients and endpoints, rules for blocking suspicious traffic.
  • Fault tolerance configuration: retries, circuit breakers, degradation when a backend is unavailable — specifying which scenarios degrade and which return an error.
  • A set of health checks: readiness/liveness for the gateway itself and synthetic requests along critical routes that catch outages before users do.
  • Operational procedures: the order of rolling out changes, rollback to a previous configuration, incident response, control points for metrics and alerts.
  • Documentation: architecture description, request flow diagram, instructions for adding a new service, and a change acceptance checklist.

We go through each artifact together with the customer's team — we don't hand it over as an archive, but walk through it on a real change: add a route, issue a key, roll back a configuration. This way, the operational procedures become a working tool, not a folder that no one opens.

Case study: how a Kong gateway eliminated session drops in a mobile app

The client is a delivery service with a mobile app on iOS and Android, around 400 thousand active users. The backend is a set of services behind a load balancer, authorization via JWT, short-lived sessions.

During peak loads (evening hours, promotions), the share of successful requests dropped to 91%: some requests were cut off at the token verification stage, clients received an error and went back to log in again.

Support recorded a surge in "kicked out of the app" tickets — up to 1,800 tickets per week, and that's without counting those who simply deleted the app.

What was changed

Deployed Kong as a single entry point for mobile traffic.

Key settings: JWT verification moved to the gateway level so that every request doesn't have to go through the authorization service; rate limits are calculated per user rather than per IP — otherwise clients behind the same mobile carrier would throttle each other; health checks of backends with automatic removal of a failed node from rotation; retries on idempotent methods with a cap on the number of attempts.

Timeouts were configured separately: previously a request could hang until the client terminated the connection itself. Now the gateway returns a clear error within a fixed time, and the app shows a retry screen instead of a "white" freeze.

Metrics before and after

Metric Before After
Share of successful requests 91% 99.6%
Recovery time after a node failure 4-6 minutes 20-30 seconds
Support tickets about sessions ~1,800/week ~120/week
Load on the authorization service peak decreased 3x

Recovery time was reduced thanks to automatic removal of a node from rotation: previously the on-call engineer learned about the problem from tickets and switched traffic manually, now the gateway does it itself, and the team receives a notification after the fact.

A month after launch, support tickets about session drops fell by more than tenfold — this freed up the first line for tasks that genuinely require a human.

How a mobile API gateway differs from a conventional web proxy

A conventional web proxy operates on the assumption that the client is a browser on a stable channel: the connection is long-lived, there is a single version, and the response can be delivered in full. A mobile API works under the opposite conditions.

The device goes into the subway, loses the network mid-request, switches between networks, and comes back with the same request identifier.

A mobile API gateway must survive connection drops and avoid creating duplicates: idempotency by request key, response buffering, and re-delivery without re-executing the operation on the backend.

The second difference is client versions. On the web, you ship a new build and everyone gets it immediately, whereas in a mobile app several versions coexist at once: some users haven't updated, and some are stuck on an old build due to store policy.

The gateway routes requests by client version and compatibility headers, serves different response schemas, and can gracefully deprecate outdated fields without breaking old builds.

This isn't a "feature for the future" but a condition under which releasing a new version doesn't turn into mass errors for those who haven't updated yet.

The third is conserving client resources. A mobile device is constrained by memory, battery, and traffic, so the gateway handles response compression, delivering only changed fields, and aggregating multiple screen requests into a single call.

Authorization is also handled here: the token is refreshed at the gateway rather than in each client, and access policy changes centrally, without shipping a new build.

The fourth is observability. For mobile traffic, you need to see not only response codes but also the share of requests on a poor network, the distribution across client versions, and time to first byte on a weak channel.

Without this, it's impossible to tell whether degradation is a backend problem or a specific app version affecting some users.

That is precisely why configuring an API Gateway for a mobile product is a separate engineering task rather than porting a web proxy configuration. We analyze the traffic profile of a specific app and assemble routing, retry, and versioning policies tailored to it.

Technical concerns before starting work

Concerns are usually not about "whether the gateway works," but about how it will fit into the current environment: what will break during migration, who owns the configuration, what happens in case of failure. Below are answers to the questions that most often come up during the evaluation stage.

Can the gateway be connected to an existing backend without rewriting services?

Yes. The gateway is placed in front of the current services and routes traffic according to rules — the services themselves do not change. Only the addresses that the mobile application uses to reach them change.

If the services already have versioning, routes are described declaratively and transferred without code changes.

How does the migration work and is there a rollback?

We shift traffic gradually: first a portion of users, then the rest. The old environment remains operational until stability is confirmed, so returning to the previous scheme takes minutes.

The gateway configuration is stored in a repository — rollback is done by reverting to the previous state, not by manual edits.

What about compatibility with older versions of the application?

Users do not update instantly, so we keep routes compatible with previous versions of the client. Deprecated calls are marked and decommissioned on a schedule, once their share drops to negligible. This way, updating the application does not become mandatory for everyone at once.

Who is responsible for operations after launch?

The configuration, routing rules, and rate-limit policies are handed over to your team along with documentation and a walkthrough of typical scenarios. We can stay on for support — in that case, route changes and incident resolution go through us according to an agreed procedure.

What happens if the gateway itself fails?

The gateway is deployed in multiple instances, and the liveness check automatically removes the failed node from load balancing. Limits and timeouts are configured so that a slow service does not take resources away from the others.

This moves a failure from the "the entire application is down" class to the "degradation of a single route" class.

Describe your environment — we will get back to you with an assessment and a work plan.

Let's discuss your task and come back with an estimate and a plan

To come back with an estimate and a plan rather than generalities, we need context about your infrastructure.

A gateway is the point through which all application traffic passes, so decisions on routing, limits, and authorization depend on how your services are currently structured, where keys are stored, and what your load requirements are. The more precise the inputs, the fewer assumptions in the estimate.

What is useful to get from you at the start:

  • A diagram of the current services: which services are behind the gateway, how they communicate with each other, whether there is already an entry point for mobile clients.
  • Load requirements: peak number of concurrent connections, traffic profile, seasonal spikes.
  • Authorization model: how tokens are issued and verified, whether external providers are needed, roles and access rights.
  • Infrastructure constraints: where the gateway is deployed, which environments (dev/stage/prod), isolation and access requirements.
  • Current problems: what is unsatisfactory about the existing solution — latency, manual route configuration, lack of observability.
  • Regulations: security requirements, logging, personal data storage, industry standards.

In response, we prepare a work plan with stages, timelines, and areas of responsibility, a target gateway architecture diagram with a rationale for choosing between Kong and Traefik for your task, as well as a list of risks and rollback methods at each step. The estimate is based on the real scope, not on an averaged template.

Describe the task in a convenient format — a call, messaging, or a short description of the inputs. We will come back with an estimate and a plan you can start from.