Pls, help rewrite nginx config to Caddyfile

There are such lines in my nginx configuration file:

root /var/www/;

location / {
try_files $uri $uri/ /index.html;

location ~* ^/(pluto|venus|aurora|vesta|flora|pluto-1|venus-1|aurora-1|vesta-1|flora-1)/(.*)$ {
proxy_buffering off;
proxy_pass https://$$2;

Help to adapt them to the Caddyfile

p.s. sorry for my English

The first two blocks would look like this: {
  root /var/www/

  rewrite {
    to {path} {path}/ /index.html

The last part gets complicated because of the way it re-uses the first path element as the subdomain of the proxy target.

You’ll need to write an individual proxy for each one, because Caddy doesn’t have a method to manipulate a dynamic proxy target in that manner.


proxy /pluto {
  without /pluto

proxy /venus {
  without /venus

# ...etc etc
1 Like

Thanks for the help

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