Closed andre-silva9975 closed 1 hour ago
i use nginx-proxy-manager and deny:all and allow: my ip address
layout.vue is show , but pages/index.vue is Forbidden
custom error.vue
<script setup lang="ts">
import type { NuxtError } from '#app'
defineProps({
error: {
type: Object as () => NuxtError,
default: undefined,
},
})
</script>
<template>
<NuxtLayout name="default">
<h1>Error</h1>
<p>{{ error?.statusCode }}</p>
<p>{{ error?.statusMessage }}</p>
</NuxtLayout>
</template>
I am not using proxy. But I faced the same problem when upgrading from 0.7.2 to 0.8.0. Solved by removing leading slash from endpoints path in auth config in nuxt.config.ts.
BEFORE (error exists):
auth: {
isEnabled: true,
baseURL: process.env.API_BROWSER_BASE_URL,
provider: {
type: 'local',
endpoints: {
signIn: {
path: '/auth/login', // ← SLASH HERE
method: 'post'
},
...
AFTER:
auth: {
isEnabled: true,
baseURL: process.env.API_BROWSER_BASE_URL,
provider: {
type: 'local',
endpoints: {
signIn: {
path: 'auth/login', // ← REMOVED LEADING SLASH
method: 'post'
},
...
ENV file:
API_BROWSER_BASE_URL=https://somesitename.dev:8443/api/v1
I don't know if by changing the version to 0.8.0 the problem will go away but I changed to local provider instead of authjs and now everything seems working. Thank you all for all the help.
Environment
Build Modules: -
Reproduction
https://github.com/sidebase/nuxt-auth-example
Describe the bug
I have a nuxt app that runs on a remote server. The server acts as a reverse proxy and forwards requests to http://localhost:3000 which is where the app is running. The problem that I am facing is that when a user tries to access app via the domain url (let's suppose is https://example.com:8000) the server can not resolve and after some time, it appears in the browser a nuxt error message like this:
500 [GET] "https://example.com:8000/api/auth/session?callbackUrl=http:%2F%2Fexample.com%2F": fetch failed
I thought the problem was in my project so I decided to try testing with the nuxt-auth example provided in the git repository (https://github.com/sidebase/nuxt-auth-example). But the error is the same. I believe the error is in the AUTH_ORIGIN. This variable is set to
AUTH_ORIGIN=https://example.com:8000
where "example.com is the domain of the server. I also tried changing this variable to http://localhost:3000 and everything seems fine except the authentication like sign in. However, I believe this is not the right value though. I am using nginx and the configuration file is the following:`server { listen 80 default_server; listen [::]:80 default_server;
Do I need to change my nginx configuration file? What do you think it should be the AUTH_ORIGIN value?
Thank you for your time.
Additional context
No response
Logs
No response