Skip to content

How to Configure URI-based Routing for River #83

@noir19

Description

@noir19

Hello,

I'm trying to set up URI-based routing in this reverse proxy project. Specifically, I want to route requests to different backend servers based on the URI path. However, I haven't been able to find clear documentation or examples on how to achieve this.

In Nginx, this can be done with a configuration like:

nginx

server {
        listen       80;
        server_name  app;
        include  /etc/nginx/conf.d/variable.conf;

        #charset koi8-r;

        location / {
            root  /etc/nginx/webapp/app;
            index  index.html index.htm;
            #try_files $uri $uri/ /app/index.html;
            gzip_static on;
        }

        location /app {
            alias  /etc/nginx/webapp/app;
            index  index.html index.htm;
            #try_files $uri $uri/ /index.html;
        }

        location /api {
            proxy_pass http://$lb;
            proxy_set_header Host $host;
            proxy_set_header X-Real_IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location ~* ^/oss/ {
            proxy_set_header X-NginX-Proxy true;
            real_ip_header X-Real-IP;

            rewrite ^/oss/(.*) /$1 break;
            proxy_pass http://$oss_server;
        }

        include  /etc/nginx/conf.d/gaode.conf;
        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

This allows different parts of an application (e.g., frontend, API, authentication) to be served by different backend servers, all through a single reverse proxy.

Is this feature currently supported in this project? If so, could you please provide an example configuration or point me to the relevant documentation?

If this feature is not currently supported, I'd like to request its addition as I believe it would greatly enhance the flexibility and usefulness of this project, allowing it to be used in more complex deployment scenarios.

Thank you for your help and consideration.

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