ampproject / ampproject/amp-toolbox

Let amp-toolbox-cors allow localhost

Open
#548 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
459
Forks
242
PR merge metrics
No merged PRs in 30d

Description

We'd like to use amp-toolbox-cors in its default configuration, where it only allows requests from known AMP caches. Unfortunately, if we do, this means that requests from localhost will fail. And, as far as I can tell, they fail silently. The server just doesn't work.

Currently we're just doing this:
```
app.use(ampCors({
verifyOrigin: false
}));
```
which of course is not ideal :)

Would it be worth allowing requests from localhost by default? Or letting the user specify an array containing additional trusted domains?

/cc @demianrenzulli @antoinebisch

Contributor guide

Open the contributing guide

Research direction

Start by locating the amp-toolbox-cors package and its default origin-verification entry point. Reproduce the localhost request failure with the default configuration, then compare the two requested outcomes: allowing localhost by default or accepting additional trusted domains. Done means the chosen behavior is documented and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.