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

"Filter" middleware cannot change URL #13

Closed
bentomas opened this issue Jun 9, 2010 · 3 comments
Closed

"Filter" middleware cannot change URL #13

bentomas opened this issue Jun 9, 2010 · 3 comments

Comments

@bentomas
Copy link

bentomas commented Jun 9, 2010

I'm trying to write a middleware that looks at the extension of the requested page, strips it from the requested URL, and adds a 'format' property matching the mime-type of the extension. But no matter what, the URL gets set back to what it was before.

Even if I pass a new request object (with next) the URL still cannot be changed.

This seems like important functionality to give to middlewares.

This seems to happen because of line 223 in index.js. I'm not sure what the best solution is, but I think it is probably not to have any routing happening at all in Connect but relegate it to middlewares. That would certainly be more rack like. Either that or before line 223 do a check to see if you are dealing with the same URL and if not don't set it.

@bentomas
Copy link
Author

bentomas commented Jun 9, 2010

Sure enough, commenting out that line fixes the problem immediately.

@tj
Copy link
Member

tj commented Jun 11, 2010

Fixed url rewriting. Closed by 2818baf

  • Added examples/url-rewrite

The example shows super basic url rewriting with
format support. This could potentially be used for
several things including i18n

@bentomas
Copy link
Author

Awesome! Thanks!

This issue was closed.
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

No branches or pull requests

2 participants