Skip to content
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

Use hpagent with axios for Apple Pay Merchant Validation with egress proxy #3891

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

marcotranchino
Copy link
Contributor

With this change, we have update the Apple Pay Merchant Validation implementation in order to use hpagent and axios in the presence of an egress proxy, as it's the case on our AWS environments.

This is needed because we want to remove the use of requestretry, however axios has a problem preventing it from working with an egress proxy[1].

For this reason, we need to use an HttpsProxyAgent with it.

We would want to use https-proxy-agent, however it has its own problem[2].

While we wait for these issues to be fixed, we can use hpagent which has been tested and works well with an egress proxy.

Further information in the JIRA ticket[3].

[1]
axios/axios#4531

[2]
TooTallNate/proxy-agents#235

[3]
https://payments-platform.atlassian.net/browse/PP-12853

Co-authored-by: Jonathan Harden [email protected]
Co-authored-by: Dominic Belcher [email protected]
Co-authored-by: Marco Tranchino [email protected]

@marcotranchino marcotranchino force-pushed the pp-12853-amendments-with-local-egress-proxy branch from c724279 to d8990e8 Compare August 9, 2024 08:51
@marcotranchino marcotranchino changed the title Use hpagent with axios for Apple Pay Merchant Validation with proxy Use hpagent with axios for Apple Pay Merchant Validation with egress proxy Aug 9, 2024
@marcotranchino marcotranchino changed the title Use hpagent with axios for Apple Pay Merchant Validation with egress proxy Use hpagent with axios for Apple Pay Merchant Validation with egress proxy Aug 9, 2024
@marcotranchino marcotranchino marked this pull request as ready for review August 9, 2024 08:52
With this change, we have update the Apple Pay Merchant Validation
implementation in order to use `hpagent` and `axios` in the presence of an
egress proxy, as it's the case on our AWS environments.

This is needed because we want to remove the use of `requestretry`, however
`axios` has a problem preventing it from working with an egress proxy[1].

For this reason, we need to use an HttpsProxyAgent with it.

We would want to use `https-proxy-agent`, however it has its own problem[2].

While we wait for these issues to be fixed, we can use `hpagent` which has
been tested and works well with an egress proxy.

Further information in the JIRA ticket[3].

[1]
axios/axios#4531

[2]
TooTallNate/proxy-agents#235

[3]
https://payments-platform.atlassian.net/browse/PP-12853

Co-authored-by: Jonathan Harden <[email protected]>
Co-authored-by: Dominic Belcher <[email protected]>
Co-authored-by: Marco Tranchino <[email protected]>
@marcotranchino marcotranchino force-pushed the pp-12853-amendments-with-local-egress-proxy branch from d8990e8 to 1ff3966 Compare August 9, 2024 09:02
Copy link
Contributor

@DomBelcher DomBelcher left a comment

Choose a reason for hiding this comment

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

Awesome

@marcotranchino marcotranchino merged commit 8c60a96 into master Aug 9, 2024
10 of 11 checks passed
@marcotranchino marcotranchino deleted the pp-12853-amendments-with-local-egress-proxy branch August 9, 2024 09:14
marcotranchino added a commit that referenced this pull request Aug 9, 2024
With a recent change[1], we have enabled Apple Pay Merchant Validaton with
`axios` and `hpagent`.

The change has been successfully verified on the Test environment, where the
code path with `axios` was switched on using an environment variable[2].

Once the code path with `axios` has been switched off also on Production, then
we will be able to stop using `requestretry` in pay-frontend by completely
deleting the code path using it for the Apple Pay Merchant Validation.

Further information in JIRA[3].

[1]
#3891

[2]
alphagov/pay-infra#4913

[3]
https://payments-platform.atlassian.net/browse/PP-12853
marcotranchino added a commit that referenced this pull request Aug 12, 2024
With a recent change[1], we have enabled Apple Pay Merchant Validaton with
`axios` and `hpagent`.

The change has been successfully verified on the Test environment, where the
code path with `axios` was switched on using an environment variable[2].

Now that the code path with `axios` has been switched ON also on Production,
then we are now able to stop using `requestretry` in pay-frontend by
completely deleting the code path using it for the Apple Pay Merchant
Validation.

Note that whilst working on this code, we have also improved the Pay CLI, and
that now it is possible to run Pay locally --with-egress-proxy. For this
reason, we are also removing the code path using `axios` without a proxy URL,
since it is not production like and it is not needed for local development
either.

Further information in JIRA[3].

[1]
#3891

[2]
alphagov/pay-infra#4913

[3]
https://payments-platform.atlassian.net/browse/PP-12853
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