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

Error 1000 "DNS points to prohibited IP" when using next-intl with Cloudflare #1124

Closed
3 tasks done
ClooudNine opened this issue Jun 13, 2024 · 2 comments
Closed
3 tasks done
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@ClooudNine
Copy link

ClooudNine commented Jun 13, 2024

Description

Hello everyone!
After implementing next-intl into my next.js application in production, I get a 1000 DNS points to forbidden IP error when trying to log in to the site. As I understand it, the problem lies in the Middleware that next-intl provides. I tried disabling intlMiddleware and the site worked completely. I turned on intlMiddleware back, I'm facing this problem. I tried removing x-frowarded-for and cf-connecting-ip from headers as described in the Clodflare documentation, but nothing helped. I also noticed that the redirect works out and I already get the error itself, being in some locale. The application is deployed in the Coolify environment version 3.12.36. How can I fix this problem?

Verifications

  • I've verified that the problem I'm experiencing isn't covered in the docs.
  • I've searched for similar, existing issues on GitHub and Stack Overflow.
  • I've compared my app to a working example to look for differences.

Mandatory reproduction URL

https://github.com/ClooudNine/cloud-retainer

Reproduction description

Steps to reproduce:

  1. Open https://retainer.cloud site
  2. See error 1000 DNS points to prohibited IP

Expected behaviour

I expect next-intl middleware not to cause 1000 DNS points to prohibited IP errors

@ClooudNine ClooudNine added bug Something isn't working unconfirmed Needs triage. labels Jun 13, 2024
@ClooudNine
Copy link
Author

I fixed it! The problem was the incorrect use of two middleware (auth.js and next-intl) together. The branch helped in the solution #596 . Thank you all!

@adilsonx
Copy link

adilsonx commented Sep 29, 2024

Hello, I have the same error with the same setup (coolify + cloudflare). I tried the solution in #596 but still have the error :( (when returning the next-intl middleware in the next auth Middleware).

@ClooudNine Can I know how did you make it ? Thanks a lot.

Code :

const intlMiddleware = createIntlMiddleware(routing);

const { auth} = NextAuth(authConfig);

const authMiddleware = auth((req) => {
  ....
//auth stuff

  return intlMiddleware(req);
});


const middleware = (req: NextRequest) => {
 .....

  if (isPublicPage) {
    return intlMiddleware(req);
  } else {
    return (authMiddleware as any)(req);
  }
};

export const config = {
  matcher: ["/((?!_next|.*\\..+$).*)"],
};

export default middleware;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants