From 5e4e96596fa26820fb2ba625da4f4ab0b146ce9c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 23 Oct 2023 12:01:22 -0400 Subject: [PATCH] Using an actix redirect. --- crates/routes/src/nodeinfo.rs | 1 + docker/nginx.conf | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/routes/src/nodeinfo.rs b/crates/routes/src/nodeinfo.rs index 736ab4e04..06d4c2dd6 100644 --- a/crates/routes/src/nodeinfo.rs +++ b/crates/routes/src/nodeinfo.rs @@ -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()), diff --git a/docker/nginx.conf b/docker/nginx.conf index a14d074a0..529e64a2a 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -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; } }