Skip to content

Commit

Permalink
feat: Remove Strict-Transport-Security to avoid HSTS
Browse files Browse the repository at this point in the history
  • Loading branch information
zu1k committed Nov 23, 2021
1 parent 9dd8b85 commit 277f6a4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions http_mitm/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
MessageHandler, MitmFilter, RequestOrResponse, Rewind,
};
use futures::{Sink, SinkExt, Stream, StreamExt};
use http::{uri::PathAndQuery, HeaderValue};
use http::{header, uri::PathAndQuery, HeaderValue};
use hyper::{
server::conn::Http, service::service_fn, upgrade::Upgraded, Body, Method, Request, Response,
Uri,
Expand Down Expand Up @@ -120,11 +120,15 @@ where
return Ok(res);
}

let res = match self.client {
let mut res = match self.client {
MaybeProxyClient::Proxy(client) => client.request(req).await?,
MaybeProxyClient::Https(client) => client.request(req).await?,
};

// Remove `Strict-Transport-Security` to avoid HSTS
// See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
res.headers_mut().remove(header::STRICT_TRANSPORT_SECURITY);

Ok(self.http_handler.handle_response(&ctx, res).await)
}

Expand Down

1 comment on commit 277f6a4

@vercel
Copy link

@vercel vercel bot commented on 277f6a4 Nov 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.