Skip to content

Add ProxyMiddleware and MiddlewareInterface #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2025

Conversation

acharron-hl
Copy link
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