Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverless config with IP whitelist and fallback to basic auth #6795

0is1 opened this issue Oct 7, 2019 · 2 comments


Copy link

commented Oct 7, 2019

Hello! I've been struggling with the following problem: how to configure serverless with IP whitelist authorizing and fallback to BasicAuth (to root path) if IP doesn't match to whitelist?

It's quite easy to add IP whitelist authorizing ( And it's also quite easy to add BasicAuth (or any Authorizer in general) to all other paths than your app root (like But how to combine those two with serverless + AWS Cloud​Formation configs?

It's also possible to add Authorizer manually to any resource method in Amazon API Gateway dashboard but I want to do that via serverless config (if it's possible?)

I've created test repo about the progress so far

There's next.js app "on the background" because that's the case with my actual project as well but it's not relevant in this context.

Thanks in advance for your help.

Edit: should I actually post this question to stackoverflow? Or what's the policy with questions in issues here?


This comment has been minimized.

Copy link

commented Oct 12, 2019

@0is1 - have you already considered using an custom authorizer lambda function?


This comment has been minimized.

Copy link

commented Oct 14, 2019

@0is1 - have you already considered using an custom authorizer lambda function?

@neverendingqs yes, but you can't configure your app root path with that logic. One of my questions is that is it possible to add authorizer for root path.

I mean this is not possible

      - http:
          path: /
          method: get
          authorizer: authorizerFunc

EDIT: actually it seems that config above is possible but serverless-nextjs-plugin just does something that break it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.