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

router.base settings not respected in fetch link to db.json #52

Closed
chrisjung-dev opened this issue May 26, 2020 · 3 comments · Fixed by #53
Closed

router.base settings not respected in fetch link to db.json #52

chrisjung-dev opened this issue May 26, 2020 · 3 comments · Fixed by #53
Labels
bug Something isn't working

Comments

@chrisjung-dev
Copy link
Contributor

chrisjung-dev commented May 26, 2020

Version

@nuxt/content: v1.2.0
nuxt: v2.12.2

Reproduction Link

repo: https://gitlab.com/chris_jung/nuxt-content-pages-poc
page: https://chris_jung.gitlab.io/nuxt-content-pages-poc/

Steps to reproduce

  1. open the page
  2. klick "about" link

What is Expected?

The about page should render

What is actually happening?

Showing "NetworkError when attempting to fetch resource."

So the page should respect the base.path setting also in the fetch actions that are fetching the "db.json"

While this works for "regular" chunks like "https://chris_jung.gitlab.io/nuxt-content-pages-poc/_nuxt/c7193aa757204530e99b.js", the db.json file is linked as follows: "https://chris_jung.gitlab.io/_nuxt/content/db.json?1590523967052"

@chrisjung-dev chrisjung-dev added the bug Something isn't working label May 26, 2020
@chrisjung-dev
Copy link
Contributor Author

chrisjung-dev commented May 26, 2020

I'm not sure what is meant with the comment "can be an url" for the public path.
if that is meant that this may be starting with // or http(s):// (like writing to an CDN), then there must be some additional checks and maybe likely the routerBasePath should not be part of it.

@AMFTech512
Copy link

AMFTech512 commented Jun 2, 2020

I don't think this is a problem with Nuxt; when I load your page, the db.json file gets a 302 HTTP status code and redirects to the GitLab authentication page. Nuxt is definitely not going to know what to do with that.

image

@chrisjung-dev
Copy link
Contributor Author

The problem still exists: clicking on another page leads to fetch the db.json again (and with wrong path this time).

benjamincanac pushed a commit that referenced this issue Jun 9, 2020
* use router basepath in client plugin

This should fix #52 by building the fetch URI using publicPath and router.base

* Apply wished changes

* fix: fix linter issues
pi0 pushed a commit that referenced this issue Feb 8, 2022
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants