# LiteFS GET request containing writes + LiteFS with multiple processes

**URL:** <https://community.fly.io/t/litefs-get-request-containing-writes-litefs-with-multiple-processes/19510>\
**Category:** General\
**Tags:** sqlite, nodejs, litefs, login-only\
**Created:** [April 27, 2024, 11:10am UTC](https://community.fly.io/t/litefs-get-request-containing-writes-litefs-with-multiple-processes/19510 "2024-04-27T11:10:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [April 28, 2024, 1:43am UTC](https://community.fly.io/t/litefs-get-request-containing-writes-litefs-with-multiple-processes/19510/2 "2024-04-28T01:43:33Z")

</div>

> [@dhakan](#):
>
> or am I screwed when it comes to distributing my db in this way?

Hi… No, LiteFS is very flexible, and the answer is rarely “you’re screwed”—but rather “you need to do a little more work.”

In this case, you can emit the `fly-replay` header from within your own application logic, right before you would have started downloading from the external source. (You can get the location of the current primary in [`/litefs/.primary`.](https://fly.io/docs/litefs/primary/))

Alternatively, it might be easier, when you’re just getting started, to do a client-side redirect to a `POST` instead. This would cost you an extra trip to the client, but it sounds like these won’t be very frequent.

> [@dhakan](#):
>
> Meaning I’d need some kind of supervisor process to make sure the db is available before those entrypoints/commands are run?

`litefs mount` is this supervisor; it won’t run any of the other commands that you pass it until it’s contacted the primary and gotten all of the latest snapshots from there, etc.

(This [older Rails thread](https://community.fly.io/t/litefs-database-migrations-with-multiple-machines-in-primary-how-to-determine-writeable-primary-machine/18752/4) might give you an idea of what’s involved a bit more concretely.)

Hope this helps a little!

---

_[View the full topic](https://community.fly.io/t/litefs-get-request-containing-writes-litefs-with-multiple-processes/19510)._
