sintj_
sintj_
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
Yea I was used to it on Netlify but on Heroku it didn't seem like it. Anyway I managed to make it work editing the middleware like this:
export default defineEventHandler((event) => {
if (process.env.NODE_ENV === "production") {
const req = event.node.req;
const proto =
req.headers["x-forwarded-proto"] || "http";

if (
proto !== "https" &&
!req.headers.host?.includes("localhost")
) {
const httpsUrl = `https://${req.headers.host}${req.url}`;
return sendRedirect(event, httpsUrl, 301);
}
}
});
export default defineEventHandler((event) => {
if (process.env.NODE_ENV === "production") {
const req = event.node.req;
const proto =
req.headers["x-forwarded-proto"] || "http";

if (
proto !== "https" &&
!req.headers.host?.includes("localhost")
) {
const httpsUrl = `https://${req.headers.host}${req.url}`;
return sendRedirect(event, httpsUrl, 301);
}
}
});
17 replies
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
nope, for the normal navigation. I did it because it didn't automatically redirect http to https when hitting the http
17 replies
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
it enforces https. Maybe I can achieve it differently?
17 replies
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
disabling it the sitemap is generated correctly, i thought these exclude parameters were enough!
17 replies
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
No description
17 replies
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
well, i indeed followed the official docs. Yeah and i don't know why the url of the api gets printed in the production sitemap. I don't really get what's wrong here
17 replies
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
No description
17 replies
NNuxt
Created by sintj_ on 4/19/2024 in #❓・help
@nuxtjs/sitemap won't generate the dynamic URLs in production
done, no success. I leave here some more details:
17 replies