Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

chore(env): deprecate insecure cookie option in configuration

Timothy Yinf977991d0ea9
diff --git a/.env.example b/.env.example
index 32b89009..5cf828fa 100644
--- a/.env.example
+++ b/.env.example
@@ -68,9 +68,10 @@ NUXT_PUBLIC_OAUTH_GITHUB_ENABLED=false
NUXT_OAUTH_GITHUB_CLIENT_ID=
NUXT_OAUTH_GITHUB_CLIENT_SECRET=
+# DEPRECATED
# INSECURE Options - DO NOT use these options in production or on public networks
# Allow cookies to be transmitted over insecure connections, effects login session security
-NUXT_ALLOW_INSECURE_COOKIE=false
+# NUXT_ALLOW_INSECURE_COOKIE=false
# Google Analytics Measurement ID (e.g. G-XXXXXXX)
NUXT_PUBLIC_GTAG_ID=
diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md
index 0c8c8d5b..64e3485e 100644
--- a/docs/guide/getting-started.md
+++ b/docs/guide/getting-started.md
@@ -234,12 +234,3 @@ openssl rand -base64 32
[Convert]::ToBase64String((1..32|%{[byte](Get-Random -Max 256)}))
```
:::
-
-:::details Logged in successfully but redirected home still unauthenticated?
-Make sure you are not accessing the site via raw IP:port. For security, cookies are set for the domain.
-
-If you must use IP + port (not recommended), add:
-```bash
-NUXT_ALLOW_INSECURE_COOKIE=true
-```
-:::
\ No newline at end of file
diff --git a/docs/zh/guide/getting-started.md b/docs/zh/guide/getting-started.md
index 4ea325c2..65c5da55 100644
--- a/docs/zh/guide/getting-started.md
+++ b/docs/zh/guide/getting-started.md
@@ -245,12 +245,3 @@ openssl rand -base64 32
[Convert]::ToBase64String((1..32|%{[byte](Get-Random -Max 256)}))
```
:::
-
-:::details 登录后台认证成功后,跳转到首页且仍为未登录状态?
-首先请确保不是直接通过 IP 地址和端口号访问。出于安全考虑,请通过配置的域名访问。
-
-如果出于某些原因,您执意要通过 IP 端口访问,请在配置项中添加:
-```bash
-NUXT_ALLOW_INSECURE_COOKIE=true
-```
-:::
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 24ca77e4..89401568 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -128,6 +128,7 @@ export default defineNuxtConfig({
mode: 'skip' as 'warn' | 'block' | 'skip',
},
},
+ /** @deprecated Defaults to allow insecure cookies now */
allowInsecureCookie: false,
},
diff --git a/server/api/auth/github.get.ts b/server/api/auth/github.get.ts
index db3ec59f..c6e6bf7e 100644
--- a/server/api/auth/github.get.ts
+++ b/server/api/auth/github.get.ts
@@ -40,7 +40,8 @@ export default defineOAuthGitHubEventHandler({
{ user: userFromEmail },
{
cookie: {
- secure: !useRuntimeConfig().allowInsecureCookie,
+ // secure: !useRuntimeConfig().allowInsecureCookie,
+ secure: false,
},
},
)
diff --git a/server/api/login.post.ts b/server/api/login.post.ts
index fc417776..26185e0c 100644
--- a/server/api/login.post.ts
+++ b/server/api/login.post.ts
@@ -34,7 +34,8 @@ export default eventHandler(async (event) => {
{ user },
{
cookie: {
- secure: !useRuntimeConfig().allowInsecureCookie,
+ // secure: !useRuntimeConfig().allowInsecureCookie,
+ secure: false,
},
},
)