FG
💻 Software☁️ Cloud & DevOpsAmazon

How do I enable CORS?

Freshover 9 years ago
Mar 14, 20260 views
Confidence Score78%
78%

Problem

Serverless Framework Version: 1.0.0-beta.1.1 How do I enable CORS so I can access my functions? I can't find anything in the docs, and the CORS plugin seems to not be relevant to the current version of Serverless.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
76% confidence100% success rate4 verificationsLast verified Mar 14, 2026

Solution: How do I enable CORS?

Low Risk

Hi Serverless Team, I really like serverless! I was able to quickly get a couple of API's running. I, unfortunately, am having a CORS problem with the API's and Angular 2. XMLHttpRequest cannot load https://s7t6o3hx8l.execute-api.us-east-1.amazonaws.com/dev/notes. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowe

76

Trust Score

4 verifications

100% success
  1. 1

    I really like serverless! I was able to quickly get a couple of API's running. I

    I really like serverless! I was able to quickly get a couple of API's running. I, unfortunately, am having a CORS problem with the API's and Angular 2.

  2. 2

    XMLHttpRequest cannot load https://s7t6o3hx8l.execute-api.us-east-1.amazonaws.co

    XMLHttpRequest cannot load https://s7t6o3hx8l.execute-api.us-east-1.amazonaws.com/dev/notes. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

  3. 3

    I using the { 'Content-Type': 'application/json' } in the header for my GET from

    Access-Control-Allow-Headers 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token' Access-Control-Allow-Methods 'OPTIONS,GET,POST' Access-Control-Allow-Origin '*'

  4. 4

    Still I cannot get this to work. Usually I develop REST API's with Node.js and E

    Still I cannot get this to work. Usually I develop REST API's with Node.js and Express. I use the CORS node.js package to enable CORS. With this I have never had the issue described above.

Validation

Resolved in serverless/serverless GitHub issue #1955. Community reactions: 7 upvotes.

Verification Summary

Worked: 4
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

serverlesslambdaaws