Skip to content

Instantly share code, notes, and snippets.

@sandeep1995
Created July 5, 2022 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeep1995/a2efb0f91a862dfc9b464520f6f16c76 to your computer and use it in GitHub Desktop.
Save sandeep1995/a2efb0f91a862dfc9b464520f6f16c76 to your computer and use it in GitHub Desktop.
Docswrite sub directory hostings for firebase
exports.blog = functions.https.onRequest((request, response) => {
let url = new URL(request.url);
url.hostname = "blog.docswrite.blog"; // use your docswrite url
url.pathname = url.pathname.replace('/blog', '');
fetch(url, request).then(d => d.text()).then(res => response.send(res));
});
"hosting": {
// ...
// Add the "rewrites" attribute within "hosting"
"rewrites": [ {
"source": "/blog/*",
"function": "blog"
} ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment