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

Added HandleContext to re-enter soft-rewritten Requests. #709

Merged
merged 1 commit into from Feb 10, 2017
Merged

Added HandleContext to re-enter soft-rewritten Requests. #709

merged 1 commit into from Feb 10, 2017

Conversation

fbettag
Copy link
Contributor

@fbettag fbettag commented Sep 23, 2016

Dear gin committers, thanks for your great and awesome work. Unfortunately i've hit a corner case to which i didn't find a sufficient solution and would like to share my fix with the community.

We are rewriting a large pile of fu^Wold PHP Code from a project i just was put upon. The problem being that this is highly SEO-crap-stuff that the URLs that have been used in the past, need to work exactly like they are, because they have been pimped, yadda yadda blah.

Anyway, i could not convince them that using a better URL Scheme with 3xx would be probably better. So technically the problem is that they have URLs with multiple parameters within one /-segment. Imagine /:categoryName-at-:city . Now since i have all the categories and cities in the database, i tried adding them all, but that didnt work out to well as it took a few hours to load all categories for all the cities. Now i hot-fixed it to be /:category/at/:city and rewrite my Request in the NotFoundHandler and stick it back into gin with .HandleContext.

Hope this either gets merged or helps someone else.

@coveralls
Copy link

coveralls commented Sep 23, 2016

Coverage Status

Coverage decreased (-0.3%) to 93.793% when pulling aeeb579 on fbettag:develop into f931d1e on gin-gonic:develop.

@fbettag
Copy link
Contributor Author

fbettag commented Sep 23, 2016

i'll make a better one with tests and stuff. I also think there is still a bug in there which i can't quiet yet confirm. If someone could take a look at it. But this is deft. a feature missing.

Copy link
Contributor

@tboerger tboerger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@appleboy appleboy merged commit 2ae8a25 into gin-gonic:develop Feb 10, 2017
@javierprovecho javierprovecho modified the milestone: 1.2 Apr 17, 2017
@dmarkham dmarkham mentioned this pull request May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants