Commit ef9f0eb 1 parent 98903c0 commit ef9f0eb Copy full SHA for ef9f0eb
File tree 1 file changed +2
-2
lines changed
src/runtime/server/middleware
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -17,20 +17,20 @@ export default eventHandler(async (event) => {
17
17
message : 'Missing Authorization header'
18
18
} )
19
19
}
20
+ const projectKey = process . env . NUXT_HUB_PROJECT_KEY
20
21
21
22
// Self-hosted NuxtHub project, user has to set a secret key to access the proxy
22
23
const projectSecretKey = process . env . NUXT_HUB_PROJECT_SECRET_KEY
23
24
if ( projectSecretKey && secretKeyOrUserToken === projectSecretKey ) {
24
25
return
25
- } else if ( projectSecretKey ) {
26
+ } else if ( projectSecretKey && ! projectKey ) {
26
27
throw createError ( {
27
28
statusCode : 401 ,
28
29
message : 'Invalid secret key'
29
30
} )
30
31
}
31
32
32
33
// Hosted on NuxtHub
33
- const projectKey = process . env . NUXT_HUB_PROJECT_KEY
34
34
if ( projectKey ) {
35
35
// Here the secretKey is a user token
36
36
await $fetch ( `/api/projects/${ projectKey } ` , {
You can’t perform that action at this time.
0 commit comments