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

Support for trailingSlash config #418

Open
simonaco opened this issue Mar 22, 2022 · 4 comments
Open

Support for trailingSlash config #418

simonaco opened this issue Mar 22, 2022 · 4 comments
Assignees
Labels
complexity: hours Issues that need less than 1 hour to be resolved good first issue Good for newcomers priority: high (P0) High priority scope: msha Issues happened a the ./src/msha level scope: rules engine Specific issues related to src/msha/routes-engine/** status: need e2e tests The issue or PR needs 1 or more e2e tests before it get addressed status: release-blocker Issues blocking a major release type: enhancement New feature or request type: RFC This is a request for comment

Comments

@simonaco
Copy link
Contributor

simonaco commented Mar 22, 2022

Is your feature request related to a problem? Please describe.
staticwebappconfig.json will include a property to configure trailingSlash behavior:

The following normalization and redirect rules will apply for each of the available configurations:

Always

When setting trailingSlashes to always, all requests that don't include a trailing slash will be redirected to a trailing slash URL. For example, /contact will be redirected to /contact/.

"trailingSlash": "always"
Requests to... returns... with the status... and path...
/about The /about/index.html file 301 /about/
/about/ The /about/index.html file 200 /about/
/about/index.html The /about/index.html file 301 /about/
/contact The /contact.html file 301 /contact/
/contact/ The /contact.html file 200 /contact/
/contact.html The /contact.html file 301 /contact/

Never

When setting trailingSlash to never, all requests ending in a trailing slash will be redirected to a non-trailing slash URL. For example, /contact/ will be redirected to /contact.

"trailingSlash": "never"
Requests to... returns... with the status... and path...
/about The /about/index.html file 200 /about
/about/ The /about/index.html file 301 /about
/about/index.html The /about/index.html file 301 /about
/contact The /contact.html file 200 /contact
/contact/ The /contact.html file 301 /contact
/contact.html The /contact.html file 301 /contact

Auto

When setting trailingSlash to auto, all requests to folders will be redirected to a URL with a trailing slash. All requests to files will be redirected to a non-trailing slash URL.

"trailingSlash": "auto"
Requests to... returns... with the status... and path...
/about The /about/index.html file 301 /about/
/about/ The /about/index.html file 200 /about/
/about/index.html The /about/index.html file 301 /about/
/contact The /contact.html file 200 /contact
/contact/ The /contact.html file 301 /contact
/contact.html The /contact.html file 301 /contact

By default, when the trailingSlash configuration is omitted, Azure Static Web Apps will apply the following rules:

Requests to... returns... with the status... and path...
/about The /about/index.html file 200 /about
/about/ The /about/index.html file 200 /about/
/about/index.html The /about/index.html file 200 /about/index.html
/contact The /contact.html file 200 /contact
/contact/ The /contact.html file 301 /contact
/contact.html The /contact.html file 200 /contact.html

Describe the solution you'd like
Static Web Apps CLI should apply the same redirect and normalization rules.

@manekinekko manekinekko added type: enhancement New feature or request good first issue Good for newcomers priority: high (P0) High priority scope: msha Issues happened a the ./src/msha level status: need e2e tests The issue or PR needs 1 or more e2e tests before it get addressed scope: rules engine Specific issues related to src/msha/routes-engine/** type: RFC This is a request for comment complexity: hours Issues that need less than 1 hour to be resolved labels Mar 22, 2022
@lcartel
Copy link

lcartel commented Apr 5, 2022

Hello @manekinekko . Can I take this issue ?

@manekinekko
Copy link
Member

Hey @lcartel yes, please go ahead. Lmk if you need any help.

@manekinekko
Copy link
Member

Any updates on your side @lcartel ? Let's know if you need help.

@manekinekko manekinekko added the status: release-blocker Issues blocking a major release label Apr 13, 2022
@lcartel
Copy link

lcartel commented Apr 24, 2022

Hey @manekinekko.
Sorry for the delay in the response. Here are the key elements blocking me right now:

  • There is a tag status: need e2e tests - does it mean that the solution has been developed yet and just needs tests?
  • I might need some precision regarding the roles of handlers, middlewares and routes-engine folders.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: hours Issues that need less than 1 hour to be resolved good first issue Good for newcomers priority: high (P0) High priority scope: msha Issues happened a the ./src/msha level scope: rules engine Specific issues related to src/msha/routes-engine/** status: need e2e tests The issue or PR needs 1 or more e2e tests before it get addressed status: release-blocker Issues blocking a major release type: enhancement New feature or request type: RFC This is a request for comment
Projects
None yet
Development

No branches or pull requests

3 participants