Skip to content

Commit 75212eb

Browse files
authored
fix(elasticloadbalancingv2): ALB auth return internal server error (#24510)
## Summary Allow HTTPS outbound traffic for security groups attached to the Application Load Balancer if the Application Load Balancer is configured with an authentication configuration. ## Why is this PR needed? Application Load Balancer authentication requires HTTPS outbound traffic. However, the security group attached to the ApplicationLoadBalancer does not allow traffic to the outside, so the code as described in the documentation will not work by itself. <img width="593" alt="image" src="https://user-images.githubusercontent.com/49480575/223705838-a047e14c-95f5-4c8e-9003-0bbdf6b9d281.png"> This issue is also documented. https://aws.amazon.com/premiumsupport/knowledge-center/elb-configure-authentication-alb/?nc1=h_ls ## Related issues Following opened issues were fixed by #21939, but related this PR. Closes #19035 #18944. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 6e73e66 commit 75212eb

File tree

37 files changed

+9406
-164
lines changed

37 files changed

+9406
-164
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
2+
import { execSync } from 'child_process';
3+
4+
const url = process.env.TEST_URL;
5+
const setupBrowser = async () => {
6+
execSync('HOME=/tmp npm install puppeteer-core @sparticuz/chromium --omit=dev --no-package-lock --no-save --prefix /tmp');
7+
const puppeteer = require('/tmp/node_modules/puppeteer-core');
8+
const chromium = require('/tmp/node_modules/@sparticuz/chromium');
9+
const browser = await puppeteer.launch({
10+
args: chromium.args,
11+
defaultViewport: chromium.defaultViewport,
12+
executablePath: await chromium.executablePath(),
13+
headless: chromium.headless,
14+
});
15+
return browser;
16+
};
17+
18+
export const handler: AWSLambda.Handler = async (_event) => {
19+
const browser = await setupBrowser();
20+
const page = await browser.newPage();
21+
await page.goto(url, {
22+
waitUntil: ['load', 'networkidle0'],
23+
timeout: 30000,
24+
});
25+
await page.type("div.visible-lg input[name='username']", process.env.TEST_USERNAME);
26+
await page.type("div.visible-lg input[name='password']", process.env.TEST_PASSWORD);
27+
await page.click("div.visible-lg input[type='submit']");
28+
const body = await page.waitForSelector('body');
29+
const textContent = await body.evaluate((el: any) => el.textContent);
30+
return textContent;
31+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export declare const handler: AWSLambda.Handler;

packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/asset.1832f4c7bb54fe8f4eb5677dc53ae4204e4b27b12077ddd397a6755206864302/index.js

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
2+
import { execSync } from 'child_process';
3+
4+
const url = process.env.TEST_URL;
5+
const setupBrowser = async () => {
6+
execSync('HOME=/tmp npm install puppeteer-core @sparticuz/chromium --omit=dev --no-package-lock --no-save --prefix /tmp');
7+
const puppeteer = require('/tmp/node_modules/puppeteer-core');
8+
const chromium = require('/tmp/node_modules/@sparticuz/chromium');
9+
const browser = await puppeteer.launch({
10+
args: chromium.args,
11+
defaultViewport: chromium.defaultViewport,
12+
executablePath: await chromium.executablePath(),
13+
headless: chromium.headless,
14+
});
15+
return browser;
16+
};
17+
18+
export const handler: AWSLambda.Handler = async (_event) => {
19+
const browser = await setupBrowser();
20+
const page = await browser.newPage();
21+
await page.goto(url, {
22+
waitUntil: ['load', 'networkidle0'],
23+
timeout: 30000,
24+
});
25+
await page.type("div.visible-lg input[name='username']", process.env.TEST_USERNAME);
26+
await page.type("div.visible-lg input[name='password']", process.env.TEST_PASSWORD);
27+
await page.click("div.visible-lg input[type='submit']");
28+
const body = await page.waitForSelector('body');
29+
const textContent = await body.evaluate((el: any) => el.textContent);
30+
return textContent;
31+
};

packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/asset.a9d3d4d1afa000946b9863b3e7578a5a5ad86d88274b3639938aa2baebf822ce/index.js

+256
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)