How to change uri after get response?

1. Output of caddy version:

v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=

2. How I run Caddy:

./caddy run

a. System environment:

Ubuntu 20.04 LTS

b. Command:

sudo ./caddy run

c. Service/unit/compose file:

I am not using Docker/systemd/Kubernetes/make so I don’t have this kind of file.

d. My complete Caddy config:

ipfsgate.test-ddns.com {
  reverse_proxy 127.0.0.1:8080
  log {
    output file /var/log/access-ipfsgate.log
  }
}

*.test-ddns.com *.eth.test-ddns.com *.dot.test-ddns.com {
  handle_path /ipfs/* {
    rewrite * /lueluelue/{path}
    reverse_proxy 127.0.0.1:8080
  }

  # this is a web server running on 4567
  reverse_proxy 127.0.0.1:4567

  log {
    output file /var/log/access-wildcard-test-ddns-com.log
  }

  tls {
    dns cloudflare RKY3vu3HYwmQdF9o8MaWYIK1JSM3O0Swk6JbgyTo
  }
}

3. The problem I’m having:

I want to:

1.user send request like: https://vitalik.eth.test-ddns.com/ipfs/QmQhCuJqSk9fF58wU58oiaJ1qbZwQ1eQ8mVzNWe7tgLNiD/
2.response should give me a webcontent like:

  1. and I want to remove this stuff from uri but keep the response body:

4. Error messages and/or full log output:

5. What I already tried:

I have tried: rewrite, route, uri replace, non of these works.

6. Links to relevant resources:

Please upgrade to v2.6.1, you’re using a pretty old version!

That’s not possible. The only way the server has of controlling the URL is by performing a redirect, but that cannot retain the response body.

You would have to make it so requests to the root of your site show the contents of that page. You can do that with rewrite * /ipfs/<id> but this would make it so only that page can be served. Probably not what you want.

This topic was automatically closed after 30 days. New replies are no longer allowed.