marz
marz
NNuxt
Created by marz on 8/8/2024 in #❓・help
Request response not updated
Hi need some help after I successfully login using this module https://nuxt.com/modules/nuxt-auth-sanctum when I first click the button to get book, it works fine I can see the response text book1, now I edited the laravelbacend api response to book2, when I click again the button it will still return book1, I am confused why the response is not updating. when I restart my docker and request again I can see now the response book2. Note: - Before I restart the container I exec the container and I can see the api text is book2, meaning my edited file is successfully sync to the container. here is my code . I just log it to console.
const getBook = () => {

const data = useFetch('https://mysite.local/api/books',{
credentials: "include",
method: "GET",
});


console.log(data);
}
const getBook = () => {

const data = useFetch('https://mysite.local/api/books',{
credentials: "include",
method: "GET",
});


console.log(data);
}
Thank you in advance
4 replies
NNuxt
Created by marz on 7/21/2024 in #❓・help
HMR in docker not working when using reverse proxy
When using the docker and caddy revers proxy the hmr is not working , but if I don't use reverseproxy only docker it works fine. chrome error in console
client:535 Mixed Content: The page at 'https://nuxtnew.larabells.local/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://nuxtnew.larabells.local:443/_nuxt/'. This request has been blocked; this endpoint must be available over WSS.
setupWebSocket @ client:535
(anonymous) @ client:530
client:532 [vite] failed to connect to websocket (SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.).
client:535 Mixed Content: The page at 'https://nuxtnew.larabells.local/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://nuxtnew.larabells.local:443/_nuxt/'. This request has been blocked; this endpoint must be available over WSS.
setupWebSocket @ client:535
(anonymous) @ client:530
client:532 [vite] failed to connect to websocket (SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.).
here is my caddfile
nuxtnew.larabells.local {

@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy @websockets nuxtnew_container:24678
reverse_proxy nuxtnew_container:4000
}
nuxtnew.larabells.local {

@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy @websockets nuxtnew_container:24678
reverse_proxy nuxtnew_container:4000
}
here is the nuxtconfig
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: false },

devServer: {
port: 4000,
host: '0.0.0.0',
},
vite: {
server: {
hmr: {
protocol: 'wss',
clientPort: 443,
},
},
},
modules: ["@nuxtjs/tailwindcss", "shadcn-nuxt"],
shadcn: {
/**
* Prefix for all the imported component
*/
prefix: '',
/**
* Directory that the component lives in.
* @default "./components/ui"
*/
componentDir: './components/ui'
}
})
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: false },

devServer: {
port: 4000,
host: '0.0.0.0',
},
vite: {
server: {
hmr: {
protocol: 'wss',
clientPort: 443,
},
},
},
modules: ["@nuxtjs/tailwindcss", "shadcn-nuxt"],
shadcn: {
/**
* Prefix for all the imported component
*/
prefix: '',
/**
* Directory that the component lives in.
* @default "./components/ui"
*/
componentDir: './components/ui'
}
})
Thank you in advance
9 replies