How to hide rewrite path in browser?

1. Caddy version (caddy version):


2. How I run Caddy:

I use CaddyFile

a. System environment:

ubuntu 20.04

b. Command:

systemctl start caddy

d. My complete Caddyfile or JSON config: {
    rewrite  / /bar
    reverse_proxy {
      header_up -Origin

3. The problem I’m having:

When a user accesses my site,, I want the path bar to be hidden in the browser. Now the URL in the browser would automatically change to How should I change my CaddyFile?

A rewrite does not expose the path changes and its effects are only internal. Can you please add:


at the top of your Caddyfile, collect some logs, and share them? Logs are actually one of the requirements in the template, but that section appears to be removed in your submission.

1 Like

Matching on / only matches requests to exactly / and nothing else. To match all paths, you must use *. Then, to preserve the path and query from the request when rewriting, you should use the {uri} placeholder.

rewrite * /bar{uri}

This would be triggered by your upstream application (the thing you’re proxying to). It’s responding to requests, instructing the browser to redirect. This is done via the Location: header in the responses.

That said, please properly and completely fill out the help topic template when asking questions on these forums. It’ll save time for both you and us, by avoiding some needless back and forth.


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