mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:23:43 +08:00
DEV: Ensure ember-cli rake theme:qunit
works with CSP enabled (#16541)
- Make proxy pass `x-forward...` headers, so that Rails can set the host/port correctly in the csp - Make `testem.js` available on a route which is within the app's default CSP
This commit is contained in:
parent
e0d7431292
commit
794d2dabf6
|
@ -78,8 +78,20 @@ if (process.argv.includes("-t")) {
|
||||||
module.exports.proxies[`/*/theme-qunit`] = {
|
module.exports.proxies[`/*/theme-qunit`] = {
|
||||||
target: `${target}${testPage}`,
|
target: `${target}${testPage}`,
|
||||||
ignorePath: true,
|
ignorePath: true,
|
||||||
|
xfwd: true,
|
||||||
};
|
};
|
||||||
module.exports.proxies["/*/*"] = { target };
|
module.exports.proxies["/*/*"] = { target, xfwd: true };
|
||||||
|
|
||||||
|
module.exports.middleware = [
|
||||||
|
function (app) {
|
||||||
|
// Make the testem.js file available under /assets
|
||||||
|
// so it's within the app's CSP
|
||||||
|
app.get("/assets/testem.js", function (req, res, next) {
|
||||||
|
req.url = "/testem.js";
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
];
|
||||||
} else if (shouldLoadPluginTestJs()) {
|
} else if (shouldLoadPluginTestJs()) {
|
||||||
// Running with ember cli, but we want to pass through plugin request to Rails
|
// Running with ember cli, but we want to pass through plugin request to Rails
|
||||||
module.exports.proxies = {
|
module.exports.proxies = {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</style>
|
</style>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
<%- if params['testem'] %>
|
<%- if params['testem'] %>
|
||||||
<script src="/testem.js"></script>
|
<script src="/assets/testem.js"></script>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user