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

[Bug]: Force https for apollo client #1359

Open
1 task done
marvincaspar opened this issue Sep 7, 2022 · 0 comments
Open
1 task done

[Bug]: Force https for apollo client #1359

marvincaspar opened this issue Sep 7, 2022 · 0 comments
Labels
bug Something isn't working triage-needed Issues that need to be checked

Comments

@marvincaspar
Copy link

marvincaspar commented Sep 7, 2022

Expected Behavior

The protocol which is used for the apollo client should be configurable and not forced to https.

I know you only should communicate with https for secure communication, but in our current environment we are hosting magento and vue storefront inside a k8s cluster. Communication from the internet is https, but communication within the cluster is http because we are already in a secure environment.

Actual Behavior

Apollo client is created with https agent

const { HttpsAgent } = AgentKeepAlive;
const agent = new HttpsAgent();

const httpLink = new HttpLink({
uri: settings.api,
// @ts-ignore
fetch: (url, options) => fetch(standardURL(url), options),
fetchOptions: {
agent,
},
...settings.customApolloHttpLinkOptions,
});

Possible Solution

Make the agent configurable or update the documentation how to change this to a http agent. I found a workaround/solution by overwriting the apollo config in the middleware.config.js file:

module.exports = {
  integrations: {
    magento: {
      configuration: {
        customApolloHttpLinkOptions: {
          useGETForQueries: true,
          fetchOptions: {},
        },
        ...
      },
      ...
    },
  },
};

Steps to reproduce

No response

What version of Magento 2 integration are you using?

1.0.2

What version of Node.js are you using?

16

What browser (and version) are you using?

What operating system (and version) are you using?

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@marvincaspar marvincaspar added bug Something isn't working triage-needed Issues that need to be checked labels Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage-needed Issues that need to be checked
Projects
None yet
Development

No branches or pull requests

1 participant