Skip to content

Commit 8031f14

Browse files
Add disable-host-check flag to fix Cloud Run host blocking
1 parent 49f33b2 commit 8031f14

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ RUN npm run build
2121
EXPOSE 8080
2222

2323
# Use Astro's preview server which handles routing correctly
24-
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "8080"]
24+
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "8080", "--disable-host-check"]
2525

astro.config.mjs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,13 @@ export default defineConfig({
1414
site,
1515
vite: {
1616
server: {
17-
host: '0.0.0.0',
17+
host: true,
18+
port: 4321,
1819
},
1920
preview: {
20-
host: '0.0.0.0',
21+
host: true,
2122
port: 8080,
22-
allowedHosts: [
23-
'localhost',
24-
'127.0.0.1',
25-
'0.0.0.0',
26-
'gdg-docs-426637717447.us-central1.run.app',
27-
'.run.app',
28-
'docs.gdgalgiers.dev'
29-
]
23+
strictPort: true
3024
}
3125
},
3226
integrations: [

vite.config.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@ import { defineConfig } from 'vite';
22

33
export default defineConfig({
44
server: {
5-
host: '0.0.0.0',
5+
host: true,
66
port: 4321,
77
},
88
preview: {
9-
host: '0.0.0.0',
9+
host: true,
1010
port: 8080,
11-
allowedHosts: [
12-
'localhost',
13-
'127.0.0.1',
14-
'0.0.0.0',
15-
'gdg-docs-426637717447.us-central1.run.app',
16-
'.run.app',
17-
'.vercel.app',
18-
'docs.gdgalgiers.dev'
19-
]
11+
strictPort: true,
12+
// Disable host checking completely
13+
disableHostCheck: true,
14+
headers: {
15+
'Access-Control-Allow-Origin': '*',
16+
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
17+
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
18+
},
2019
}
2120
});

0 commit comments

Comments
 (0)