Configuring http for forwarding traffic

Hi,

How to configure http for forward traffic. Similar to nginx, for example:

# NGINX vhost block example
location = /$PATH {
        proxy_pass http://127.0.0.1:15000;
        proxy_http_version 1.1;

        ### Set WebSocket headers ###
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        ### Set Proxy headers ###
        proxy_set_header        Accept-Encoding   "";
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        add_header              Front-End-Https   on;

        proxy_redirect     off;
        access_log  off;
        error_log off;
}

Thanks, Jacobo

With caddy you can simply do this

domain.com {
    reverse_proxy 127.0.0.1:15000
}

The headers and such are all set automatically by default.
Or

domain.com {
    reverse_proxy /somepath* 127.0.0.1:15000
}

Be careful with recommending that. Path matchers are exact, so this would only match /somepath and nothing else.

Also if you match a subpath, you should have some other handler to handle otherwise unmatched requests.

Noted. Edited post for wildcard. In my case I use the absolute path matcher for public access so as to control it in a more meticulous way.

Thanks @victor @francislavoie. In my case, I am looking for it to be a strict path