Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
request processing system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Feb 2017 at 09:14 UTC
Updated:
2 May 2017 at 08:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
yobottehg commentedI created a pull request on the upstream for this:
https://github.com/asm89/stack-cors/pull/33
Comment #3
dawehnerI'm wondering whether one solution could be to ensure that the cors middleware runs after the page cache one? This would ensure that code is executed all the time?
Comment #4
wim leersComment #5
hampercm commentedI don't think an upstream change is what's needed for fixing this.
Here's a patch based on @dawehner's suggestion from #3. This seems to solve the issue. Let's see if automated tests pass...
Comment #6
dawehnerHere is a test. It is adapting the kernel test in a true functional tests, given CORS is all about CORS.
Just a random sidenote: CORS doesn't allow empty header values.
Comment #7
wim leers@dawehner wrote:
The patch is making CORS' middleware have priority 250, PageCache's middleware has priority 200. This means CORS runs before PageCache.
So this is not implementing what #3 suggested. But at the same time, I think this is what @dawehner actually meant, I think he just wrote it incorrectly?
Comment #8
dawehnerWell, I think I should have written that the CORS middleware should wrap the pagecache one. A more outer middleware can do things before and after the more inner middleware.
Yeah, for me the bugfix is as expected.
Sadly the test only patch doesn't fail :(
Comment #9
hampercm commented@dawehner the tests in #8 look OK, but they don't test what's currently not working: a request from a different origin from the original request (whose response is cached). That's why they're passing on the test-only patch.
Added a test case to do just that. It uses allowed-origin of '*', which is what the bug report states.
Comment #11
wim leerss/CrossSite/CrossOrigin/
Leaving at NR so @dawehner can review this too.
Comment #12
dawehnerThe new test certainly makes more sense!
Comment #13
alexpottre #11 the test was called CrossSite before so lets fix that in a followup if we want.
Committed and pushed cc77425 to 8.4.x and 54b5b2e to 8.3.x. Thanks!
As this is a bug fix backporting to 8.3.x.