Skip to content

[BUG] 405 OPTIONS Method Not Allowed for /pins Endpoint When Called from Angular Frontend (CORS Question) #35

@Tuntii

Description

@Tuntii

RustAPI Version

0.1.10

Rust Version

NaN

Operating System

Windows

Description

Discussed in #16

Originally posted by PeterGumball, January 14, 2026

When calling the /pins endpoint to create a resource from an Angular client at http://localhost:4200/pins, the following error occurs:

Client error occurred error_id=err_7a8bbcda99504d17bd5fcd079b93e76d error_type=method_not_allowed Method OPTIONS not allowed for /pins status=405 environment=development

The backend enables CORS via .layer(CorsLayer::permissive()).

Do you have an idea what could be causing this?

PS: I have never really understood CORS, and it is a closed book to me.

Steps to Reproduce

  1. Run the RustAPI backend with .layer(CorsLayer::permissive())
  2. Use an Angular frontend (running at localhost:4200) to make a request to POST /pins
  3. Observe a client error for the OPTIONS method (status 405)

Expected Behavior

The browser should successfully complete the CORS preflight request and allow the frontend to make POST requests without a 405 error on OPTIONS.

Actual Behavior

The backend returns a 405 Method Not Allowed for the OPTIONS method when the client attempts a CORS preflight request.

Additional Context

  • CORS is enabled in the backend via .layer(CorsLayer::permissive()).
  • Client: Angular frontend running at localhost:4200
  • Related discussion: method_not_allowed Method OPTIONS not allowed #16
  • Error message:
    Client error occurred error_id=err_7a8bbcda99504d17bd5fcd079b93e76d error_type=method_not_allowed Method OPTIONS not allowed for /pins status=405 environment=development
    
  • User PS: Unfamiliarity with CORS ("it is a closed book to me").

Checklist

  • I have searched for similar issues and couldn't find any.
  • I have tried the latest version of RustAPI.
  • I have provided all the required information above.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions