How to substitute patterns in response header?

We are building a reverse proxy for http://crates.io. When a user visits a url like http://crates.io/api/v1/crates/matches/0.1.6/download, it will be 302 redirected to http://static.crates.io/.... Now I was wondering is there any way to substitute all statis.crates.io in location header of the response with our-static-mirror.domain.com, so that we can also reverse proxy static.crates.io.

1 Like

When this Pull Request is merged, you should be able to.

You’ll then be able to put header_downstream Location static.crates.io our-static-mirror.domain.com within the proxy directive to fix the redirects.

2 Likes

Pretty slick PR, imo. With that and http.filter, I expect you should be able to reverse proxy literally anything, at any arbitrary hostname and base path.

3 Likes

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