Skip to content

[FAQ] #487

Open
Open

Description

@chakirou18

Course

ai-dev-tools-zoomcamp

Question

Why does a Playwright security test return HTTP 403 instead of the expected HTTP 404 when using Vite rather than production Nginx?

Answer

During my AI Dev Tools Zoomcamp 2026 final project, AI OfficeFlow, I encountered a browser-testing issue caused by differences between the development and production environments.

Problem: The production frontend used Nginx to block access to private routes with HTTP 404. However, the Cloud test environment used Vite, which forwarded certain requests to the API and returned HTTP 403.

As a result, 14 out of 15 browser tests passed, while one security assertion failed.

Checklist

  • I have searched existing FAQs and this question is not already answered
  • The answer provides accurate, helpful information
  • I have included any relevant code examples or links

Activity

  1. github-actions commented on Oct 21, 2026

    @github-actions
    Contributor

    ✅ FAQ NEW proposal created in PR #488

    Please review and approve the changes.

  2. chakirou18 commented on Oct 21, 2026

    @chakirou18
    Author

    How to solve it:

    1. Verify whether Playwright is targeting the Vite development server or production Nginx.
    2. Compare the HTTP responses for the same private route.
    3. Check Nginx routing and access-denial rules.
    4. Run production-security tests against the production routing layer.
    5. Keep the expected HTTP 404 assertion if it is part of the production security contract.

    Do not weaken security tests simply to make them pass in development.

    After testing in the intended local environment, all 15 browser tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions