Redirect support #1539
Replies: 4 comments 14 replies
-
You probably want a stream handler. It has been suggested before to add such a feature. I have put some thoughts about it here: #1346 (comment) The proposed "rewrite" can either result in a 3xx status code or an internal redirect. The router would only list valid routes, and the rewriter would simply modify the incoming URL to point to one of these routes. |
Beta Was this translation helpful? Give feedback.
-
Hi The routes for compilation are
What is the value the constraint function must return if it is a match and what if it is not? Kind Regards |
Beta Was this translation helpful? Give feedback.
-
Thank you for the info. I will keep looking to see if I missed something. Best |
Beta Was this translation helpful? Give feedback.
-
Hi Loïc I found another problem while trying to debug the cowboy_router.erl,
Now going back to your proposal I have two questions:
Kind Regards |
Beta Was this translation helpful? Give feedback.
-
Hello
After working several years on java based CMS systems I have an idea to build a CMS system and wanted to use cowboy for this. I am new to both erlang and cowboy.
Here is my problem
I want to be able to support redirects. Normally the sites I have seen have several thousand redirect URLs that are used mostly by marketing and some for legacy pages.
I was thinking to create a rule in cowboy to check first if the request URL is matching any of the thousands URLs
{"some.site", [
{'', redirect_handler, []},
{"/", welcome_handler, []},
{'', cms_handler, []}
]}.
The problem is though that once you match the first rule, I couldnt find a way to tell the router to continue with the next rule.
In java based server usually there is a FROWARD feature that you can forward the request to another servlet. IS there something similar to forward the request to another handler?
I though to use Constraints for that but besides a few line on the documentation I couldnt find any example.
Has anybody any idea on how to solve this problem?
Normally is java based apps this kind of problems is solved by the use of filters. Is there something similar here?
Kind Regards
Nikolas
Beta Was this translation helpful? Give feedback.
All reactions