Help with some rewrite

hi, help plz

rewrite /app/index.html {
to /{1}
}

i have install webogram at abc.site.com/app/index.html#/login
but i want to open at /

Hi @simplemice,

Your substitution has a capture group, but you don’t have a regex capturing anything, so the instance of {1} is always empty for any given request.

I’m not sure exactly what you mean by “i want to open at /”, I’m sorry. Could you be more specific?

hi @Whitestrake tnx for reply, i want to rewrite abc.site.com/app/index.html#/login to abc.site.com

You can simply rewrite the exact URIs:

rewrite /app/index.html#/login /

@Whitestrake i try it, it not working for me, because #/login is autoinsert in url on opening abc.site.com/app/index.html

What’s your full Caddyfile?

@Whitestrake

abc.site.com {
     log /var/log/caddy/abc.log
     errors /var/log/caddy/abc_errors.log
     tls {
        dns cloudflare
}
     proxy / 172.17.0.5:8000 {
        header_upstream Host {host}
        header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-For {remote}
        header_upstream X-Forwarded-Proto {scheme}

        fail_timeout 0s
        header_upstream X-Forwarded-Ssl on
        transparent
    }
     rewrite /app/index.html {
to /{1}
}
}

There’s nothing in your Caddyfile putting the #/login there, so it’s probably your upstream server doing that. You’ll probably need to configure it not to.

@Whitestrake ohh… tnx for u help… on upstream work docker image with webogram and caddy is an proxy for it :frowning: uncomfortable open full url */app/index.html

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