cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.3k stars 1.1k forks source link

docs: add docs for RateLimiter #120

Open xialeistudio opened 4 months ago

xialeistudio commented 4 months ago

Add a RateLimiter quickstart to docs.

87

mustafasegf commented 3 months ago

hey, while this code compiles, it gives 403 error while trying because the host header isn't modified to one.one.one.one. It would be better for the example to also add

    async fn upstream_request_filter(
        &self,
        _session: &mut Session,
        upstream_request: &mut RequestHeader,
        _ctx: &mut Self::CTX,
    ) -> Result<()> {
        upstream_request.insert_header("Host", "one.one.one.one").unwrap();
        Ok(())
    }

just like in the https://github.com/cloudflare/pingora/blob/36e09ca389dac053948722a8ed24caa011495439/docs/quick_start.md

xialeistudio commented 3 months ago

hey, while this code compiles, it gives 403 error while trying because the host header isn't modified to one.one.one.one. It would be better for the example to also add

    async fn upstream_request_filter(
        &self,
        _session: &mut Session,
        upstream_request: &mut RequestHeader,
        _ctx: &mut Self::CTX,
    ) -> Result<()> {
        upstream_request.insert_header("Host", "one.one.one.one").unwrap();
        Ok(())
    }

just like in the https://github.com/cloudflare/pingora/blob/36e09ca389dac053948722a8ed24caa011495439/docs/quick_start.md

Thanks to your valuable reminder, I have promptly addressed the issue.

johnhurt commented 1 month ago

Nice. I'm marking this one as accepted. We will ingest it internally, and it should show up in our main branch (attributed correctly to you) in our next sync. Thanks!

xialeistudio commented 1 month ago

Nice. I'm marking this one as accepted. We will ingest it internally, and it should show up in our main branch (attributed correctly to you) in our next sync. Thanks!

Thanks!