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
[FEATURE] add proxy to prevent preflight CORS requests for API on client side #30
Comments
Thanks, we'll take a look into this! |
I think this is quite important, as this would be a real nice performance improvement (no blocking preflight requests at all on client side). So I would rate it a 3 (1 being the highest importance), only because one can achieve this on their own. Maybe it's also sufficient to only document a solution to this right now, I can provide how we did it in our shopware-pwa projects which should basically work on shopware-frontends, too :) |
I have a created a simple nuxt3 module based on nuxt-proxy and http-proxy-middleware. We used this in our POC for shopware frontends. |
@meeshoogendoorn great to see you here :) |
@niklaswolf of course 👍 export default defineNuxtConfig({
shopware: {
shopwareEndpoint: 'https://some-shopware-6-instance.com',
shopwareAccessToken: 'ACCESSTOKEN',
}
}); the above configuration is the default way to configure The This way, So, if we take the example above, the following configurations will be with proxy, in this example i assume you run the export default defineNuxtConfig({
shopware: {
shopwareEndpoint: 'http://localhost:3000',
proxyDestinationEndpoint: 'https://some-shopware-6-instance.com',
shopwareAccessToken: 'SWSCWTKXULEZNGRKSDBLSG1IDQ',
proxy: true,
}) |
@meeshoogendoorn thanks, now I understand it :) |
I accidentally removed the |
@niklaswolf and @meeshoogendoorn can we close this issue or is there something left? 🤔 |
@BrocksiNet Yes, this issue can be closed. See the Community Modules Section in the documentation: |
related shopware-pwa issue: vuestorefront/shopware-pwa#1602
I won't describe the whole issue here again, as everything described in the linked issue is basically still the case :)
I think this is a feature that would benefit many projects/developers and it could also be optional/configurable.
Basically what I'd like to see:
location.origin
.Like this every API-request would origin from the same domain and therefore there wouldn't be any CORS issues :)
The text was updated successfully, but these errors were encountered: