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

fix: hard-coded redirection http status on resource.redirect() #607

Closed
3 tasks done
jed1976 opened this issue Feb 15, 2022 · 4 comments · Fixed by #608
Closed
3 tasks done

fix: hard-coded redirection http status on resource.redirect() #607

jed1976 opened this issue Feb 15, 2022 · 4 comments · Fixed by #608
Assignees
Labels
Bug Something isn't working as expected

Comments

@jed1976
Copy link

jed1976 commented Feb 15, 2022

Summary

What:

When calling this.redirect(url, response), the status code is hard-coded to 302.

It would be beneficial to be able to set the status code to 301 as well for permanent redirects.

Why:

From an SEO perspective, it is considered a good practice to use 301 instead of 302 for redirecting pages.

Acceptance Criteria

Below is a list of tasks that must be completed before this issue can be closed.

Example Pseudo Code (for implementation)

response.status = 301;
this.redirect(url, response);

Or possibly alter the method signature:

this.redirect(url, response, 301);
@crookse
Copy link
Member

crookse commented Feb 15, 2022

hey @joedakroub , that's actually a bug. it shouldn't be hardcoded. working on a fix. will reach out to you once i open a PR for the team to review. thanks for raising this!

@crookse crookse self-assigned this Feb 15, 2022
@crookse crookse added the Bug Something isn't working as expected label Feb 15, 2022
@crookse crookse changed the title 301 Redirect option fix: hard-coded redirection http status on resource.redirect() Feb 15, 2022
@crookse
Copy link
Member

crookse commented Feb 15, 2022

hey @joedakroub , PR is open at #608. as a drashland rule, we can't release this fix/feature without documentation. i'll be writing that documentation sometime tomorrow. again, thanks for bringing up this issue!

@crookse
Copy link
Member

crookse commented Feb 16, 2022

@joedakroub , documentation is written. will have this released soon after the docs are approved. ill ping you once we release and will close out this issue afterward

@crookse crookse reopened this Feb 16, 2022
@crookse
Copy link
Member

crookse commented Feb 17, 2022

hey @joedakroub! v2.5.3 is released, you can add a status code to the redirect call once you pull down that version. documentation is here: https://drash.land/drash/v2.x/tutorials/resources/redirections

@crookse crookse closed this as completed Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working as expected
Development

Successfully merging a pull request may close this issue.

2 participants