You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Image cannot be loaded if caching is turned on when image crossorigin option is set to 'use-credentials'
To Reproduce
Should be clear from description, but well. Steps to reproduce the behavior:
Set checkCrossOrigin to true
Set image 'crossorigin' attribute to 'use-credentials', like <img crossorigin='use-credentials' src=...>
Set server configuration to allow cors requests only from specific domains.
See error (:
Expected behavior
No cross-origin error should occur
More detailed description
So, I've been fighting this bug whole day, was trying to understand if problem is in server configuration or somewhere else. But this error never occurred before, only with this library, so I went through the source code.
If browser caching is disabled (through developer options, for example), then everything works fine.
If image is cached and no timestamp is added to url (take a look at red area in screenshot), then cropper will fail on line 219 (blue area in screenshot) due to cross origin error (if settings are set like described in 'to reproduce' section).
SUGGESTED SOLUTION
There is my used solution, we just add the timestamp to crossOriginUrl every time:
Screenshots
Here's a screenshot of code block in cropper.js file
The text was updated successfully, but these errors were encountered:
liesahead
changed the title
Cross origin issue when 'use-credentials' is used.
Cross origin issue when 'use-credentials' is used. Solution suggestion inside.
May 10, 2019
Describe the bug
Image cannot be loaded if caching is turned on when image crossorigin option is set to 'use-credentials'
To Reproduce
Should be clear from description, but well. Steps to reproduce the behavior:
<img crossorigin='use-credentials' src=...>
Expected behavior
No cross-origin error should occur
More detailed description
So, I've been fighting this bug whole day, was trying to understand if problem is in server configuration or somewhere else. But this error never occurred before, only with this library, so I went through the source code.
If browser caching is disabled (through developer options, for example), then everything works fine.
If image is cached and no timestamp is added to url (take a look at red area in screenshot), then cropper will fail on line 219 (blue area in screenshot) due to cross origin error (if settings are set like described in 'to reproduce' section).
SUGGESTED SOLUTION
There is my used solution, we just add the timestamp to crossOriginUrl every time:
Screenshots
Here's a screenshot of code block in cropper.js file
The text was updated successfully, but these errors were encountered: