Help with some rewrite


(mice) #1

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 /


(Matthew Fay) #2

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?


(mice) #3

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


(Matthew Fay) #4

You can simply rewrite the exact URIs:

rewrite /app/index.html#/login /

(mice) #5

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


(Matthew Fay) #6

What’s your full Caddyfile?


(mice) #7

@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}
}
}

(Matthew Fay) #8

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.


(mice) #9

@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