Skip to content

Add ProxyMiddleware and MiddlewareInterface#38

Merged
acharron-hl merged 2 commits intomasterfrom
feature/proxy-support
Jun 13, 2025
Merged

Add ProxyMiddleware and MiddlewareInterface#38
acharron-hl merged 2 commits intomasterfrom
feature/proxy-support

Conversation

@acharron-hl
Copy link
Copy Markdown
Contributor

@acharron-hl acharron-hl commented Jun 13, 2025

Overview

We've been having to a lot of internal network proxied recently and it's a bit annoying to keep moving it around between projects. Here I've done the following:

  • Make HttpRequest expose and be better at working with UriInterface instead of just string $url. The existing url is marked soft deprecated but is still there and kept in sync.
  • Add a MiddlewareInterface to make implementing them easier.
  • Add a ProxyMiddleware that:
    • Replaces the host in the request uri.
    • Downgrades the scheme to http
    • Sets the host header.
    • Tracks the original uri in the request.
  • Adds a better exception messages when we throw and we were proxied.
    • Example: Request "GET https://example.com/base-url/api?query#hash (proxied through http://0.0.0.0:8091/base-url/api?query#hash)" failed with ..."

ReadmeMe tests (httpbin)

httpbin.org seems to gone now, so I've removed the few tests hitting it. They were already actually handled by our local http server tests in any case.

@acharron-hl acharron-hl requested a review from a team June 13, 2025 13:29
@acharron-hl acharron-hl merged commit 14d6a09 into master Jun 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants