37 questions
2
votes
0
answers
425
views
Can I use auth.js to authenticate users across two different Next.js apps on separate subdomains?
I'm currently using auth.js in a multi-zone Next.js app setup. My nextjs' multi-zone architecture consists of several apps inside the same subdomain: https://console.my-app.com. All apps within this ...
1
vote
0
answers
160
views
NextJS Infinite redirection loop when using middleware
I'm trying to make some routing logic using NextJS middleware. Based on this code: https://github.com/alexrusin/nextjs-cognito-auth/blob/5-reset-password-end/src/middleware.ts
When user is not ...
1
vote
0
answers
101
views
Fetch API cannot load http://localhost:8081/api/auth/login due to access control checks
Summary
I am using NextJS as frontend service and ExpressJS as backend service. I am using getServerSideProps for SSR in some of my pages. For the cors issue on production, I am setting proxy while ...
0
votes
1
answer
128
views
Next.js- dynamic import failed to load the component with a variable as module path
`We need to load the component with dynamic import
for eg: we have hello.js component in "component/shared/hello.js"
and we want to load the "hello" component in login component ...
0
votes
1
answer
509
views
How to configure Next.js config rewrites between two microfrontends?
I'm trying to organize a microfrontend architecture of two existing Next.js apps. Setup (when asked select app router without src folder, other options irrelevant):
npx [email protected] main
npx ...
0
votes
1
answer
1k
views
How to do dynamic routing with next13
I'm fairly new to nextjs 13, especially with the app router, I have a very big project in react that I would like to migrate and I know it won't be an easy road, I've started to tackle a bit of the ...
1
vote
0
answers
297
views
Next.js 14 'Wrong mime type' error after deploying on IIS
I have a very simple Next.js app that uses app router and i18n and everything works good locally, but as soon as I deploy it to IIS, I get warnings in console for both js and css files: The script ...
1
vote
1
answer
887
views
NextJS App Router: redirect all routes to two nested dynamic routes as root
was wondering if anyone could help with this issue I'm having learning the app router in regards to deeply nested dynamic routes.
Lets say I have an ecommerce shop which hosts multiple stores with ...
0
votes
0
answers
90
views
How to convert multiple Next.js pages to customs domains (hosted on Vercel)
I would like to redirect Next.js page to a custom domain:
Example :
For the https://domainzzz.com/user/josh, Josh would like his page to be access by https://joshwebsite.io
For the https://domainzzz....
3
votes
0
answers
720
views
How to add custom request header to Rewrites in Next.js
I have a reverse proxy setup using the API router in Next.js. Currently, my code for the proxy configuration looks like this:
async rewrites() {
return [
{
source: '/api/:path*',
...
1
vote
0
answers
121
views
How to rewrite URL on nextjs Page?
PAGE CODE
export default async function SpecificAssetPage({
params,
}: {
params: SpecificAssetProps;
}) {
const session = await getServerSession(authConfig);
const userId = session?.user!.id;
...
0
votes
1
answer
2k
views
Nextjs with next-i18next: How to generate a sitemap for every domain?
I am building a Next.js project that supports multiple domains through the next-i18next package (without using Sub-path Routing). Now, I need to create different sitemaps for the various domains that ...
1
vote
0
answers
574
views
Adding i18n to a NextJS project with custom middleware routing - accessing the Dynamic variable
Background:
I have a NextJS application using version 13.5 and the app router. Using middleware, I have a subdomain of app, as well as a neatly organised local file structure for the main website's ...
1
vote
0
answers
242
views
How to load critical styles for a NextJs app
I have played around with the experimental feature optimizeCss, but vercel suggests that we don't use it anymore. Also, I am not really sure how this would work when we try Server side streaming.
I ...
2
votes
2
answers
6k
views
Rewriting for Locales using Next.js and next-intl
I'm currently utilizing Next.js (v13.5.4) and next-intl (v3.0.0-beta.19) for internationalization. My goal is to modify the URL structure for locales from a format like en-GB to en/UK.
I've set up ...
0
votes
1
answer
399
views
NextJS rewrite to publicly accessible app not working
I am reaching out since I am working on migrating a reverse proxy deployed using AWS to a NextJS app, by using the support Next has on redirects/rewrites. The goal is to use the NextJS app as the ...
1
vote
0
answers
61
views
How often will client hit the vercel server if middleware, getStaticProps and getInitialProps(_app.tsx) are present
How often will client hit the nextjs server if I add the node-cache npm package in app's middleware which uses rewrites and all my pages have getStaticProps along with getStaticPaths and middleware ...
1
vote
1
answer
1k
views
Nextjs server side permanent redirection rather 404 page
I have a Next.js app with three routes: /home, /about, and /contact.
If a user lands on a route that doesn't exist, by default, Next.js will direct them to the 404 page.
However, I want to avoid ...
4
votes
1
answer
4k
views
How to rewrite request after next-intl middleware receives it
I have next-intl setup in my project and its working fine. Now I have some urls(onelink urls with query params) that I want to deeplink so that those URL's can land on specific screens.
I am getting ...
0
votes
1
answer
2k
views
NextJS 13 Error: fetch failed Unhandled Runtime Error
When I try to fetch data in NextJS 13 an error encountered Unhandled Runtime Error.
what is the Error here.
async function getPosts() {
const res = await fetch(
"https://jsonplaceholder....
1
vote
3
answers
1k
views
Getting 404 Not Found error when refreshing dynamic page in DirectAdmin deployment
I'm encountering a "404 Not Found" error when trying to refresh a dynamic page in my Next.js application deployed on DirectAdmin. The error occurs only when I attempt to refresh the page, ...
0
votes
2
answers
2k
views
Nextjs Middleware rewrite routes and won't redirect even when user is logged in
I am facing an issue in nextjs middleware I am building a ecommerce app that has three actors [admin , customer , vendor] in middleware i have a function that decode the token from header cookies and ...
1
vote
1
answer
1k
views
Nextjs | getStaticPaths | Error: Call retries were exceeded
Got "Call retries were exceeded" error when i got to dynamic slug page, as per the discussion
github i downgraded my project from 13 to 12 version, but still getting same issue. let me share ...
1
vote
0
answers
1k
views
NextResponse.rewrite does not work (return blank page)
Trying to implement maintenance mode using middleware.
If i try NextResponse.next() after the rewrite, website loads normally and does not go to
maintenance page. I got correct response with html page ...
3
votes
0
answers
1k
views
Nextjs middleware rewrite page props sometimes undefined
Hope this finds yo well.
I'm working on a multilang website with translated URLs. I'm on Next.js 13.3
To handle the translated rotues i'm using a middleware. ( I have a large number of rewrites/...
1
vote
0
answers
857
views
Next Js 13.3.0 rewrites doesn't work for external API
I'm trying to call an external API using rewrites from Next server to avoid CORS error. To do that I've been reading Next docs Rewrites but is not working for me.
My next.config.js file is like this:
...
1
vote
0
answers
571
views
Next.js fallback rewrites return no props from getServerSideProps, when accessed via next/link on Vercel
I have rewrites defined under afterFiles: and fallback: in next.config.js
In my local dev environment, both sets of rewrites work perfectly.
When running on Vercel, the fallback rewrites do not work ...
1
vote
0
answers
58
views
The provided `as` value (/product-ui/order/EC0701HICR) is incompatible with the `href` value (/order/[orderId])
The url server will append the path to navigate the modules. I get an error when nextjs custom server appends prefix: /product-ui I don't understand what's wrong with my custom server file about ...
2
votes
0
answers
420
views
Next js Redirect to other domains Not Working
I can redirect to the path in same domain but enable to redirect if domain is different. This error only occurs on firebase hosting and is working fine on localhost with yarn dev.
code:
const router = ...
3
votes
0
answers
760
views
NextJs rewrites does not proxy API calls in getServerSideProps
I am using react-query prefetchQuery and NextJS (v.13) getServerSideProps along with its rewrites option in next.config.js file to proxy API calls.
The rewrites looks like this:
async rewrites() {
...
3
votes
1
answer
2k
views
rewrites in next js working fine in local, but not working after deployment in vercel
this is how my next.config.js looks like =>
{
async rewrites() {
return [
{
source: '/:path*',
destination: `/:path*`,
},
{
source: '/sell',
...
2
votes
1
answer
1k
views
Next.js rewrites + custom dynamical header for axios on the server-side
How i can do dynamical header for axios on the serve-side? I want to make functionality of cities, without edit nextjs folder structure. Rewrities from nextjs solves my problem, but I can't set the ...
6
votes
0
answers
4k
views
NextJS rewrites error while proxying a request to the backend
I'm trying to proxy a request to a backend with Next rewrites.
next.config.js:
async rewrites() {
return [
{
source: "/api/:path*",
destination: "http://somedomain.loc/...
1
vote
1
answer
757
views
How to access html file inside iframe in production
I am creating a web app where, this app will generate a .html file in public/ directory. And after that i want to show that generated html file on a page using iframe .
I am using NextJS for this task....
1
vote
0
answers
2k
views
Next Js does not proxying API requests
I'm new to next and I'm facing the following problem and i will be glad for your help
In my next application i use rewrites to get around cors during api requests.
async rewrites() {
return [
...
6
votes
0
answers
825
views
NextJS, How inject Authorization header before next.config rewrites happens?
I'm using NextJS to build our Frontend.
The NextJS API just provides basic checks and then redirects to proper micro-services.
But I'm struggling to find the proper approach.
Since we are using Next ...
3
votes
0
answers
2k
views
NextJs localized rewrites with query parameters reloads the browser and throws failed to load script error
I'm facing an issue while using rewrites and query parameters. I'll describe it further below. if I've lost you at any point during the explanation feel free to ask for a clarification.
Expected ...