Skip to content

Load balancing with "content_by_lua block" #35

@Fatahir

Description

@Fatahir

I have a content_by_lua block which execute when below location run.

location / {
      content_by_lua '
          local client = require "readuser"
          client.ReadUser();
      ';
    }

I want to do load balancing between multiple servers so that all servers run same lua block. I thought i did this by

http
{
 upstream read
 {
  server one;
  server two;
  server three;
 }
}

server {
 location / {
  proxy_pass http://read
  content_by_lua '
          local client = require "readuser"
          client.ReadUser();
      ';
 }
}

but it did not work. How can I achieved this with lua block?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions