magento2
magento2 copied to clipboard
[Bug]: Force https for apollo client
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
https://github.com/vuestorefront/magento2/blob/a9864faf9239667c81a4d6275e0cf4716dfb7b05/packages/api-client/src/helpers/magentoLink/graphQl.ts#L20-L21 https://github.com/vuestorefront/magento2/blob/a9864faf9239667c81a4d6275e0cf4716dfb7b05/packages/api-client/src/helpers/magentoLink/graphQl.ts#L69-L77
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
- [X] I agree to follow this project's Code of Conduct