LiteFS proxy always-forward option not working for me

Hi, I’m trying to use the always-forward option mentioned here:

I’ve got the proxy setup in my litefs.yml shown below but
when I make requests to that path it doesn’t seem to be
forwarded to the primary as I get error messages like this in my logs:

2024-07-03T16:20:51.427 app[48ed640a7d7308] sjc [info] level=INFO msg="fuse: write(): wal error: read only replica"
  addr: ":8080"
  target: "localhost:3000"
  db: "db"
    - "*.ico"
    - "*.png"
    - "^/always-write"

The actual requests are going to a route that looks like:

app.get('/always-write/:tag/:number', async (req, res) => {

I.e. the path will be something like /always-write/foo/10.

Am I missing something silly?

From General to Questions / Help

Hi… No, not silly, just undocumented, :leaves:

Looking at the source code, these are glob-style expressions rather than regexps (per se).

If I’m remembering my own past experiments correctly, it should work if you change it to "/always-write/*"—which would get compiled into the regexp ^/always-write/.*$.

Hope this helps!

Added docs

Oh, for crying out loud. I should have figured that out. Thanks!

I even thought at one point, “It’s weird that passthrough takes a glob style pattern while this one is a regexp”. And I looked at the source but I didn’t look deeply enough into http.CompileMatch.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.