@echo off title Fix Web Access :: Auto elevate to admin net session >nul 2>&1 if %errorLevel% neq 0 ( echo Requesting admin privileges... powershell -Command "Start-Process cmd -ArgumentList '/c ""%~f0""' -Verb RunAs" exit /b ) echo ============================================ echo Fix Web Backend Access echo ============================================ echo. :: 1. Disable residual system proxy (blocks localhost) echo [1/4] Disabling system proxy... reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f >nul 2>&1 reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f >nul 2>&1 echo Done. echo. :: 2. Add firewall rules for Python echo [2/4] Adding firewall rules for Python... for /f "delims=" %%i in ('where python') do set PYTHON_PATH=%%i if not defined PYTHON_PATH ( echo ERROR: Python not found in PATH pause exit /b 1 ) echo Python path: %PYTHON_PATH% netsh advfirewall firewall delete rule name="PythonWeb" >nul 2>&1 netsh advfirewall firewall add rule name="PythonWeb" dir=in action=allow program="%PYTHON_PATH%" enable=yes profile=any >nul netsh advfirewall firewall delete rule name="PythonWebOut" >nul 2>&1 netsh advfirewall firewall add rule name="PythonWebOut" dir=out action=allow program="%PYTHON_PATH%" enable=yes profile=any >nul echo Done. echo. :: 3. Flush DNS cache echo [3/4] Flushing DNS cache... ipconfig /flushdns >nul 2>&1 echo Done. echo. :: 4. Show excluded port ranges for reference echo [4/4] TCP excluded port ranges (for reference): netsh interface ipv4 show excludedportrange protocol=tcp echo. echo ============================================ echo Fix complete! Now: echo 1. Close ALL browser windows and reopen echo 2. Run: python web_server.py echo 3. Open: http://127.0.0.1:5050/ echo ============================================ pause