Using an actix redirect.

This commit is contained in:
Dessalines 2023-10-23 12:01:22 -04:00
parent 9a1d0e9c01
commit 5e4e96596f
2 changed files with 2 additions and 4 deletions

View file

@ -17,6 +17,7 @@ pub fn config(cfg: &mut web::ServiceConfig) {
"/nodeinfo/2.0.json",
web::get().to(node_info).wrap(cache_1hour()),
)
.service(web::redirect("/version", "/nodeinfo/2.0.json"))
.route(
"/.well-known/nodeinfo",
web::get().to(node_info_well_known).wrap(cache_3days()),

View file

@ -56,7 +56,7 @@ http {
}
# backend
location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
location ~ ^/(api|pictrs|feeds|nodeinfo|version|.well-known) {
proxy_pass "http://lemmy";
# proxy common stuff
proxy_http_version 1.1;
@ -68,8 +68,5 @@ http {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Redirect /version to /nodeinfo/2.0.json
rewrite /version /nodeinfo/2.0.json permanent;
}
}