Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hubs Cloud] Fix local assets path and upload proxy for localhost #5146

Merged
merged 2 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/utils/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ let isAdmin = false;
const el = document.querySelector(`meta[name='env:${x.toLowerCase()}']`);
configs[x] = el ? el.getAttribute("content") : process.env[x];

if (x === "BASE_ASSETS_PATH" && configs[x]) {
if (x === "BASE_ASSETS_PATH" && configs["BASE_ASSETS_PATH"]) {
brianpeiris marked this conversation as resolved.
Show resolved Hide resolved
// eslint-disable-next-line no-undef
__webpack_public_path__ = configs[x];
__webpack_public_path__ = configs["BASE_ASSETS_PATH"];
brianpeiris marked this conversation as resolved.
Show resolved Hide resolved

// BASE_ASSETS_PATH might be a relative URL like "/" when it is set in
// .env or .defaults.env when running locally. We need to convert that
// to an absolute URL.
if (configs["BASE_ASSETS_PATH"] && !configs["BASE_ASSETS_PATH"].startsWith("http")) {
brianpeiris marked this conversation as resolved.
Show resolved Hide resolved
configs["BASE_ASSETS_PATH"] = new URL(configs["BASE_ASSETS_PATH"], window.location);
brianpeiris marked this conversation as resolved.
Show resolved Hide resolved
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ module.exports = async (env, argv) => {
if (req.method === "OPTIONS") {
res.send();
} else {
const url = req.path.replace("/cors-proxy/", "");
const url = req.originalUrl.replace("/cors-proxy/", "");
request({ url, method: req.method }, error => {
if (error) {
console.error(`cors-proxy: error fetching "${url}"\n`, error);
Expand Down