runisland / meteor-ionic4

Meteor Atmosphere package that automatically imports Ionic4 Web Components into your Client templates
MIT License
14 stars 6 forks source link

Multi subdomains CORS problem #7

Open devarthurribeiro opened 5 years ago

devarthurribeiro commented 5 years ago

Meteor.absoluteUrl returns the ROOT_URL. When working with multiple subdomains in the same app this causes a problem of cors that prevents ionic

https://github.com/runisland/meteor-ionic4/blob/917c466c16e0bb4f5a3f4573de19b7456d96f21c/package/ionicResourcesUrl.js#L14

Replace with this line in my local package to solve the problem:

const resourcesUrl = window.location.origin + '/packages/ionic4/dist/ionic/'

You could evaluate a possible update in your package to resolve this bug?

thank you man!

ghybs commented 5 years ago

Hi,

Thank you for your message, for having digged through the package code, and for sharing your solution!

I understand that in the case of using a single Meteor app accessed through different subdomains, using window.location.origin may provide a suitable workaround.

However it seems to me that a Meteor app can also be configured to be accessed through a subpath, in which case that workaround would fail, while ROOT_URL can still be configured appropriately.

Therefore it looks like none of these 2 options are universal enough.

The only solution that I can think of right now would be if we could provide somehow a configurable path, more versatile the Meteor.absoluteUrl. I am not sure yet how to provide such option.

Please let me know if you have some ideas!