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

Link is truncated in the middle #52381

Closed
1 task done
devevignesh opened this issue Jul 7, 2023 · 13 comments · Fixed by #52640
Closed
1 task done

Link is truncated in the middle #52381

devevignesh opened this issue Jul 7, 2023 · 13 comments · Fixed by #52640
Labels
linear: next Confirmed issue that is tracked by the Next.js team. locked

Comments

@devevignesh
Copy link

devevignesh commented Jul 7, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.16.1
      npm: 9.5.1
      Yarn: 1.22.17
      pnpm: 8.6.5
    Relevant Packages:
      next: 13.4.9
      eslint-config-next: 13.4.7
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: export

Which example does this report relate to?

with-static-export

What browser are you using? (if relevant)

Brave: 1.52.122 Chromium: 114.0.5735.110

How are you deploying your application? (if relevant)

No response

Describe the Bug

I have encountered an issue with the Link component where the link path is getting cut in the middle. For example, when using the following link: <Link href="/client/uuid/coaching-guide" />, it redirects to /client/uuid/coaching-, resulting in a 404 error. Similar to this: #48996 (comment)

Expected Behavior

Expect it to go to "/client/uuid/coaching-guide"

To Reproduce

next.config.js

/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
	output: 'export',
};

module.exports = nextConfig;
  1. Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example with-static-export with-static-export-app
  1. Serve site via npx serve@latest out

NEXT-1415

@devevignesh devevignesh added the examples Issue/PR related to examples label Jul 7, 2023
@timneutkens timneutkens added linear: next Confirmed issue that is tracked by the Next.js team. and removed examples Issue/PR related to examples labels Jul 7, 2023
@devDoubleH
Copy link

@leedyche
Copy link

Im experiencing the exact same issue. Im not using any redirects, i do have output:'export' set to true and any links I use get truncated and 404. I previously had the .txt issue (im using the latest nextjs) so ive set prefect={false} in order to avoid that. Currently I cant get any links to work at all when published as a static website does anyone have any work arounds? thanks

@devDoubleH
Copy link

Did you checkout link above

@leedyche
Copy link

the link above doesnt help? its just to the docs regarding redirects, the issue i have is with a simple link, the url is truncated, i dont have redirects enabled

@devDoubleH
Copy link

Sorry for misunderstanding could give some examples of truncated urls please ?

@leedyche
Copy link

no problem, so an example link in my code is
<Link href="/weddings" > weddings </Link>

Locall this works in debug, when i publish as a static site this will redirect to

https://baseurl/ours

likewise this link

<Link href="/ourstory" > Ourstory</Link>

navigates to

https://baseurl/ours

however, if i navigate to the correct url by typing in the address ie go to

https://baseurl/ourstory

I see the page, and all the links now work - untill i go to the home page, then all the links break again

thanks

@devDoubleH
Copy link

Is there any page called ourstory in your app ?

@leedyche
Copy link

yes, as i said if i navigate to the url directly it works without issue

@devDoubleH
Copy link

I am on nextjs 13.4.8 and everything okey

@leedyche
Copy link

It works for me in debug running locally, the issue only occurs when i publish using

`/** @type {import('next').NextConfig} */
const nextConfig = {
output:'export',
distDir: 'dist'
}

module.exports = nextConfig`

@zhangxinyong12
Copy link

When I use nginx as a proxy, refreshing the page prompts 403. If I set nginx to try_files $uri $uri/ /index.html;

Refresh and jump to the home page. How do you solve it? I don't understand.

@zhangxinyong12
Copy link

location / {
if ($uri ~* .(html)$) {
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
try_files $uri $uri/ /index.html;
}

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linear: next Confirmed issue that is tracked by the Next.js team. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants