Skip to content

Commit

Permalink
edging my brain anneurism (pt. 16)
Browse files Browse the repository at this point in the history
  • Loading branch information
spectrapulse committed May 11, 2024
1 parent 05b36b7 commit 00a597e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Dockerfile.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM nginx:mainline

ENV UDS=1 BIND_UNIX=/var/run/piped-proxy/actix.sock

WORKDIR /app/

RUN apt-get update && \
Expand Down
9 changes: 7 additions & 2 deletions docker/nginx/conf.d/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ server {
listen 80;
server_name _;


location / {
location ~ (/api/v4/|/api/manifest/) {
include snippets/proxy.conf;
add_header Cache-Control private always;
}

location ~ /videoplayback {
include snippets/proxy.conf;
add_header Cache-Control private always;

if ($http_user_agent ~* "com\.github\.libretube") {
rewrite ^(.*)$ $1?ump=1 break;
}
}

location / {
include snippets/proxy.conf;
add_header Cache-Control "public, max-age=604800";
}
}
11 changes: 10 additions & 1 deletion docker/nginx/snippets/proxy.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
proxy_buffering on;
proxy_buffers 1024 16k;
proxy_set_header X-Forwarded-For "";
proxy_set_header CF-Connecting-IP "";
proxy_hide_header "alt-svc";
sendfile on;
sendfile_max_chunk 512k;
tcp_nopush on;
aio threads=default;
aio_write on;
directio 16m;
proxy_hide_header Cache-Control;
proxy_hide_header etag;
proxy_http_version 1.1;
proxy_set_header Connection keep-alive;
proxy_max_temp_file_size 32m;
# access_log off;
proxy_max_temp_file_size 32m;
proxy_pass http://unix:/var/run/piped-proxy/actix.sock;
10 changes: 0 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
async fn main() -> std::io::Result<()> {
println!("Running server!");

let _env_vars = ["UDS", "BIND_UNIX", "PROXY", "PROXY_USER", "PROXY_PASS"];
for env_var in _env_vars.into_iter() {
println!(
"{var_name}: {var_value}",
var_name=env_var,
var_value=env::var(env_var)
.unwrap_or_else(|_| "NUL".to_string())
);
}

let server = HttpServer::new(|| {
// match all requests
App::new().default_service(web::to(index))
Expand Down

0 comments on commit 00a597e

Please sign in to comment.