github.com/ronaksoft/rony@v0.16.26-0.20230807065236-1743dbfe6959/example/redirect/README.MD (about)

     1  # Redirect Example
     2  
     3  Rony is capable of handling redirection server side or client side. This example demonstrates
     4  this feature.
     5  
     6  To bring up 3 instance of the server you can use `goreman`[https://github.com/mattn/goreman].
     7  
     8  1. Build the executable: `go install ./cmd/cli-redirect`
     9  
    10  2. Run services with goreman or bring three (or more) instances manually: `goreman start`
    11  > Please mind that there is --seed flag in Procfile, you must change it according to your environment
    12  > otherwise your cluster would not work properly.
    13  
    14  3. Open browser: `http://localhost/info/server-redirect/3/sometext`
    15  > This demonstrates the server side redirection. You are asking request from replica-set 3 but
    16  > sending your request to node1 which is replica-set 1. But it internally redirects your request
    17  > to node3 and sends its result back to you
    18  
    19  
    20  4. Open browser: `http://localhost/info/client-redirect/3/sometext`
    21  > This demonstrates the client side redirection. You will see that server redirects you to new
    22  > url by sending HTTP 307 and the address of the node3
    23  >