2

I am currently using Caddy as a reverse proxy.

rewrite / /index.html

https://localhost/ --> https://localhost/index.html

https://localhost/?p1=v1&p2=v2 --> https://localhost/index.html?p1=v1&p2=v2

Now I want to additionally change the path /static to index.html. However, a URL parameter static=true should then be added.

https://localhost/static --> https://localhost/index.html?static=true

This additional URL parameter should not influence the existing parameters.

https://localhost/static?p1=v1&p2=v2 --> https://localhost/index.html?static=true&p1=v1&p2=v2

How do I have to adjust my caddyfile to make this work as desired? I just tried the following, but unfortunately it didn't work.

rewrite /static /index.html?static=true
michaelT
  • 1,533
  • 12
  • 41

1 Answers1

0

{query} is the old query params,so can do like this:

rewrite /static index.html?{query}&static=true

the documents: placeholders

vishun
  • 79
  • 6