Comments (6)
So this seems to be working when I use php artisan serve
instead of running it through Docker. However, we really rely on Docker in our workflow. Is this also possible to achieve with docker?
from breeze-nuxt.
I managed to make it work with docker, using 127.0.0.1
instead of localhost
on both the front and the back with different ports. But when I log in it returns the error The route dashboard could not be found
. or it tells me that I am not authenticated if I ask for the user right after logging in.
from breeze-nuxt.
@matthiastjong I finally make it work with Laravel Sail, but in order to work you need to access the app via http://127.0.0.1 URL instead the localhost.
The following parameters are required:
# .env in the laravel project
FRONTEND_URL=http://127.0.0.1:3000
SESSION_DOMAIN=.127.0.0.1
SANCTUM_STATEFUL_DOMAINS=127.0.0.1:3000
SESSION_DRIVER=cookie
// .env in the nuxt project
NUXT_PUBLIC_BACKEND_URL=http://127.0.0.1
NUXT_PUBLIC_FRONTEND_URL=http://127.0.0.1:3000
// nuxt.config.ts
import { defineNuxtConfig } from 'nuxt/config'
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: ['@nuxtjs/tailwindcss'],
runtimeConfig: {
public: {
backendUrl: process.env.NUXT_PUBLIC_BACKEND_URL,
frontendUrl: process.env.NUXT_PUBLIC_FRONTEND_URL
}
},
imports: {
dirs: ['./utils']
}
})
And finally when you run the app in dev mode you need to adjust the package.json command to this:
{
...,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev --host 127.0.0.1",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
...
}
I hope I have been clear and helpful
from breeze-nuxt.
Thanks for sharing what worked out for you @JaavierR !
FYI there is no need to change the runtimeConfig
inside nuxt.config.ts
as the values there are treated as the defaults and will get overridden if they are defined in your environment variables as long as they adhere to the naming convention NUXT_PUBLIC_ETC
.
from breeze-nuxt.
Do the settings mentioned above fix your issues with docker @matthiastjong?
from breeze-nuxt.
Hi @amrnn90 , we have checked out your solution and it works! Amazing stuff.. After this we can authenticate our local API 😄 Thank you!
from breeze-nuxt.
Related Issues (20)
- How to use $larafetch in server? HOT 6
- It would be cool if you can make this a nuxt module HOT 4
- initCsrf is always called HOT 2
- The guest middleware not working with pinia stores HOT 29
- Redirecting to Login Page on Refresh HOT 2
- [nuxt] [request error] [unhandled] [500] [GET] "http://localhost:8000/api/user": <no response> fetch failed HOT 1
- useLarafetch with async functions inside other composable HOT 4
- Error 500 A composable that requires access to the nuxt instance.... HOT 6
- Being redirected to login page on refresh HOT 8
- Duplicated XSRF TOKEN with custom subdomains HOT 4
- useEvent is not defined HOT 1
- npm run build error [nuxt] [request error] [unhandled] [500] useEvent is not defined HOT 6
- Modify schema of login/register/password-reset etc. response
- Improper handling of the session
- useSubmit validationErrors available until nextTick
- Login error on production machine, cors works but I get the error message | "CSRF token mismatch." HOT 1
- There is a csrf problem when calling login via post action on the productions environment.
- $larafetch does not work with the installed "axios": "^0.21.2", from @vercel in your program.
- The developers of this application should please contact me. I need help with the deployment. Your effort will of course be paid... HOT 1
- in $larafetch.ts no cookies can be read out. it is undefined when transferring to the login page, therefore the error message "CSRF token mismatch." HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from breeze-nuxt.