getlift/lift

SinglePageApp should support .wasm files

AtteR opened this issue · 1 comments

AtteR commented

Start from the Use-case

Hello,

Currently CloudFront request function redirects .wasm files to /index.html (https://github.com/getlift/lift/blob/master/src/constructs/aws/SinglePageApp.ts#L48)

This makes the .wasm files load as HTML, which means that .wasm file is not loaded properly.

Adding wasm to REDIRECT_INDEX seems to fix this problem.

Example Config

No response

Implementation Idea

Add wasm to REDIRECT_REGEX:

var REDIRECT_REGEX = /^[^.]+$|.(?!(css|gif|ico|jpg|jpeg|js|png|txt|svg|woff|woff2|ttf|map|json|webp|xml|pdf|webmanifest|avif|wasm)$)([^.]+$)/;

This seems to fix the issue.

Hi, thanks for the report, feel free to send a pull request.