Add detailed mobile debugging
Browse files
crossword-app/backend/src/app.js
CHANGED
@@ -53,7 +53,9 @@ app.use(express.json({ limit: '10mb' }));
|
|
53 |
app.use(express.urlencoded({ extended: true, limit: '10mb' }));
|
54 |
|
55 |
app.use((req, res, next) => {
|
56 |
-
|
|
|
|
|
57 |
next();
|
58 |
});
|
59 |
|
@@ -105,7 +107,12 @@ if (process.env.NODE_ENV === 'production') {
|
|
105 |
|
106 |
// Handle React Router routes - serve index.html for non-API routes
|
107 |
app.get('*', (req, res) => {
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
109 |
res.sendFile(path.join(staticPath, 'index.html'));
|
110 |
});
|
111 |
} else {
|
|
|
53 |
app.use(express.urlencoded({ extended: true, limit: '10mb' }));
|
54 |
|
55 |
app.use((req, res, next) => {
|
56 |
+
const userAgent = req.get('User-Agent') || 'unknown';
|
57 |
+
console.log(`${new Date().toISOString()} - ${req.method} ${req.path} - User-Agent: ${userAgent.substring(0, 100)}`);
|
58 |
+
console.log(`Headers:`, JSON.stringify(req.headers, null, 2));
|
59 |
next();
|
60 |
});
|
61 |
|
|
|
107 |
|
108 |
// Handle React Router routes - serve index.html for non-API routes
|
109 |
app.get('*', (req, res) => {
|
110 |
+
const userAgent = req.get('User-Agent') || '';
|
111 |
+
const isMobile = /iPhone|iPad|Android|Mobile/i.test(userAgent);
|
112 |
+
console.log(`Serving index.html for: ${req.path}, Mobile: ${isMobile}, UA: ${userAgent.substring(0, 50)}`);
|
113 |
+
|
114 |
+
// Ensure we're sending the right content type
|
115 |
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
116 |
res.sendFile(path.join(staticPath, 'index.html'));
|
117 |
});
|
118 |
} else {
|