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

Hosting on Github pages (with .nuxt.space) causes MIXED CONTENT error #3111

Open
Pentadome opened this issue Feb 9, 2025 · 1 comment
Open
Labels

Comments

@Pentadome
Copy link

Pentadome commented Feb 9, 2025

Environment

Github pages

Version

nuxt: 3.15.4
nuxt/content: 3.1.0

Reproduction

  1. Build with npx nuxi build --preset github_pages
  2. Host website on github pages.
  3. Github redirects (301) from https://x.nuxt.space/api/content/content/database.sql?v=V4I9ATcky to http://x.nuxt.space/api/content/content/database.sql/?v=V4I9ATckyK causing a MIXED CONTENT error and the browser blocking the request.

I am not sure why github pages does this.

Description

Workaround

Add the following to nuxt.config.ts

app: {
  head: {
    meta: [
      {
        "http-equiv": 'content-security-policy',
        content: 'upgrade-insecure-requests'
      }
    ]
  }
},

Additional context

No response

Logs

@farnabaz
Copy link
Member

Try adding autoSubfolderIndex: false to nitro.prerender options.

export const defineNuxtConfig({
   nitro: {
    prerender: {
      autoSubfolderIndex: false
    },
  }
})

This will prevent creating a directory for pre-rendered files, an should resolve the issue

@farnabaz farnabaz added the v3 label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants