fix(dashboard): keep the dashboard out of search indexes #361
No files matched your search
@@ -62,7 +62,7 @@ gloo-timers = { version = "0.3", features = ["futures"], optional = true }
|
||||
# Server-only
|
||||
axum = { version = "0.8", optional = true }
|
||||
mongodb = { workspace = true, optional = true }
|
||||
tower-http = { version = "0.6", features = ["cors", "trace"], optional = true }
|
||||
tower-http = { version = "0.6", features = ["cors", "trace", "set-header"], optional = true }
|
||||
secrecy = { workspace = true, optional = true }
|
||||
dotenvy = { version = "0.15", optional = true }
|
||||
tokio = { workspace = true, optional = true }
|
||||
|
||||
@@ -2,6 +2,7 @@ use axum::routing::get;
|
||||
use axum::{middleware, Extension};
|
||||
use dioxus::prelude::*;
|
||||
use time::Duration;
|
||||
use tower_http::set_header::SetResponseHeaderLayer;
|
||||
use tower_sessions::SessionManagerLayer;
|
||||
|
||||
use compliance_core::config::AppEnv;
|
||||
@@ -90,6 +91,12 @@ pub fn server_start(app: fn() -> Element) -> Result<(), DashboardError> {
|
||||
// Liveness for the container healthcheck; outside `/api/`, so
|
||||
// it needs no session.
|
||||
.route("/health", get(|| async { "ok" }))
|
||||
// A signed-in application: nothing here belongs in a search
|
||||
// index (the orca agent adds no headers of its own).
|
||||
.route(
|
||||
"/robots.txt",
|
||||
get(|| async { "User-agent: *\nDisallow: /\n" }),
|
||||
)
|
||||
.route("/auth", get(auth_login))
|
||||
.route("/auth/callback", get(auth_callback))
|
||||
.route("/logout", get(logout))
|
||||
@@ -100,7 +107,11 @@ pub fn server_start(app: fn() -> Element) -> Result<(), DashboardError> {
|
||||
.layer(Extension(PendingOAuthStore::default()))
|
||||
.layer(middleware::from_fn(require_auth))
|
||||
.layer(Extension(server_state))
|
||||
.layer(session);
|
||||
.layer(session)
|
||||
.layer(SetResponseHeaderLayer::overriding(
|
||||
axum::http::HeaderName::from_static("x-robots-tag"),
|
||||
axum::http::HeaderValue::from_static("noindex, nofollow"),
|
||||
));
|
||||
|
||||
axum::serve(listener, router.into_make_service())
|
||||
.await
|
||||
|
||||
Reference in new issue
Block a user