fix: resolve login loading loop caused by Vite HMR reconnects + rate limiting

- Add @SkipThrottle() to POST /auth/refresh so repeated silent-refresh calls
  from page reloads no longer exhaust the rate limit (HTTP 429)
- Configure Vite HMR explicitly with host/clientPort/protocol=wss so the
  WebSocket connects correctly through Traefik instead of reconnecting every ~1s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas Reitz 2026-03-14 11:35:18 +01:00
parent 79ad5e4be3
commit ad3a580d0b
2 changed files with 7 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import {
HttpCode, HttpCode,
HttpStatus, HttpStatus,
} from '@nestjs/common'; } from '@nestjs/common';
import { SkipThrottle } from '@nestjs/throttler';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { Public } from '../../common/decorators/public.decorator'; import { Public } from '../../common/decorators/public.decorator';
@ -59,6 +60,7 @@ export class AuthController {
*/ */
@Post('refresh') @Post('refresh')
@Public() @Public()
@SkipThrottle()
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
@ApiOperation({ summary: 'Access-Token erneuern (Silent Refresh)' }) @ApiOperation({ summary: 'Access-Token erneuern (Silent Refresh)' })
async refresh( async refresh(

View file

@ -13,6 +13,11 @@ export default defineConfig({
port: 8080, port: 8080,
host: true, host: true,
allowedHosts: ['.xinion.lan'], allowedHosts: ['.xinion.lan'],
hmr: {
host: 'insight.xinion.lan',
clientPort: 443,
protocol: 'wss',
},
proxy: { proxy: {
'/api/v1/crm': { '/api/v1/crm': {
target: 'http://localhost:3100', target: 'http://localhost:3100',