To test this:
1. First we need to start hosting the web app on a different origin, so the browser will require a CORS header for the requests. We can do it like this:
- Edit `/etc/hosts` file and add `127.0.0.1 test.localhost` line. Thanks to this we can navigate to `test.localhost:3000/comm/` and still get redirected to `127.0.0.1` (note: for some reason this continued to work for me even without this line)
- Modify domains in `webapp_cors.json` and `commapp_url.json` to `http://test.localhost:3000`
2. Then we want to make the the webapp connect to the keyserver endpoints (`squadCalRouter`). Modify the default dev `urlPrefix` in `web/redux/default-state.js` to `http://localhost:3000` (remove the `/comm`)
- We also need to change the `proxy` in `squadcal_url.json` to `"none"` because otherwise keyserver tries to determine the request api like it was redirected from apache and fails. But we don't have any proxy so we change this setting.
3. Load the web app
- Without CORS middleware the `initial-redux-state` request fails with `Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource`
- With CORS middleware (changes in this diff) the request goes through
I have also confirmed that after removing the upload-endpoint-specific CORS setup, uploads still load on the web app.
Also tested if both `nix develop` and keyserver migration created the new file.
Adding @ashoat as reviewer because of new dependency.