-
Notifications
You must be signed in to change notification settings - Fork 10
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
Simple HTTP Proxy #49
Conversation
… requester Signed-off-by: Alexander Ignition <[email protected]>
Add MultiplexLogHandler
@Alexander-Ignition Hi! |
@modestman I have updated the README and tests for the new feature. For verification, you can run through Xcode with different environment variables set in the schema. or you can run from the terminal with different environment variables CATBIRD_PROXY_ENABLED=1 swift run catbird --package-path Packages/CatbirdApp you can try to run requests via curl as in README |
|
||
`CATBIRD_PROXY_URL` — If you specify this URL Catbird will run in write mode. In this mode, requests to Catbird will be redirected to the `CATBIRD_PROXY_URL`. Upon receipt of response from the server it will be written to the `CATBIRD_MOCKS_DIR` directory. | ||
> Catbird supports proxying only HTTP requests. HTTPS requests are not supported! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you think, it is possible in the future to make a proxy for HTTPS endpoints, like Charles or Proxyman?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be cool! But Vapor does not support configuring the server as a proxy. To do this, you would have to use SwiftNIO without Vapor. I haven't been able to make a working prototype yet
Co-authored-by: Anton Glezman <[email protected]>
Close: #40 #39
Catbird only supports direct requests to its host.
To do this, the
CATBIRD_PROXY_URL
environment variable is set. And she was also responsible for switching to recording mode. This confused the users.In this MR, this variable has been split into 3
CATBIRD_RECORD_MODE
to explicitly enable recording modeCATBIRD_REDIRECT_URL
to set the url to which direct requests will be redirectedCATBIRD_PROXY_ENABLED
to enable proxying mode so that requests from different hosts can be redirected to a real server