How to make a resource available in Plone View accessible by frontend?

I have a view called @@flourish, and it includes some static files like flourish.embed.js, styles.css, and index.html.

When I try to access these files directly from the frontend, I get a 401 error. Even using getApiResourceWithAuth doesn’t help, because the request to .../context/@@flourish/path-to-static-files doesn’t include the auth token.

I managed to fetch the .js file by using a query parameter such that the request first routes to @@flourish, so that it have a token, but the CSS file still fails. That’s because it’s being loaded from within the index.html, and my middleware doesn’t have a way to add the token to that request.

I thought expandToBackendURL might be a savior here, but I guess it works the same way as getApiResourceWithAuth as both makes a request to backend.

This is my @@flouish View implemented : eea.api.dataconnector/eea/api/dataconnector/browser/flourish.py at de9f8e4b4b4a4bea5e467d94584bd9d8a81579e8 · eea/eea.api.dataconnector · GitHub

Update: The issue is due to varnish config set to remove cookies for req that ends with .js|.css