Skip to content

Commit f977991

Browse files
committed
chore(env): deprecate insecure cookie option in configuration
1 parent 69dd0d7 commit f977991

File tree

6 files changed

+7
-21
lines changed

6 files changed

+7
-21
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ NUXT_PUBLIC_OAUTH_GITHUB_ENABLED=false
6868
NUXT_OAUTH_GITHUB_CLIENT_ID=
6969
NUXT_OAUTH_GITHUB_CLIENT_SECRET=
7070

71+
# DEPRECATED
7172
# INSECURE Options - DO NOT use these options in production or on public networks
7273
# Allow cookies to be transmitted over insecure connections, effects login session security
73-
NUXT_ALLOW_INSECURE_COOKIE=false
74+
# NUXT_ALLOW_INSECURE_COOKIE=false
7475

7576
# Google Analytics Measurement ID (e.g. G-XXXXXXX)
7677
NUXT_PUBLIC_GTAG_ID=

docs/guide/getting-started.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,3 @@ openssl rand -base64 32
234234
[Convert]::ToBase64String((1..32|%{[byte](Get-Random -Max 256)}))
235235
```
236236
:::
237-
238-
:::details Logged in successfully but redirected home still unauthenticated?
239-
Make sure you are not accessing the site via raw IP:port. For security, cookies are set for the domain.
240-
241-
If you must use IP + port (not recommended), add:
242-
```bash
243-
NUXT_ALLOW_INSECURE_COOKIE=true
244-
```
245-
:::

docs/zh/guide/getting-started.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,3 @@ openssl rand -base64 32
245245
[Convert]::ToBase64String((1..32|%{[byte](Get-Random -Max 256)}))
246246
```
247247
:::
248-
249-
:::details 登录后台认证成功后,跳转到首页且仍为未登录状态?
250-
首先请确保不是直接通过 IP 地址和端口号访问。出于安全考虑,请通过配置的域名访问。
251-
252-
如果出于某些原因,您执意要通过 IP 端口访问,请在配置项中添加:
253-
```bash
254-
NUXT_ALLOW_INSECURE_COOKIE=true
255-
```
256-
:::

nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export default defineNuxtConfig({
128128
mode: 'skip' as 'warn' | 'block' | 'skip',
129129
},
130130
},
131+
/** @deprecated Defaults to allow insecure cookies now */
131132
allowInsecureCookie: false,
132133
},
133134

server/api/auth/github.get.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export default defineOAuthGitHubEventHandler({
4040
{ user: userFromEmail },
4141
{
4242
cookie: {
43-
secure: !useRuntimeConfig().allowInsecureCookie,
43+
// secure: !useRuntimeConfig().allowInsecureCookie,
44+
secure: false,
4445
},
4546
},
4647
)

server/api/login.post.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export default eventHandler(async (event) => {
3434
{ user },
3535
{
3636
cookie: {
37-
secure: !useRuntimeConfig().allowInsecureCookie,
37+
// secure: !useRuntimeConfig().allowInsecureCookie,
38+
secure: false,
3839
},
3940
},
4041
)

0 commit comments

Comments
 (0)