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

Introduce mounting cascade apps #1471

Merged
merged 3 commits into from Oct 25, 2013

Conversation

Projects
None yet
5 participants
@ujifgc
Member

ujifgc commented Oct 23, 2013

More info at #796

Router will traverse through apps in mount order.
If app mount path matches the request and the app returns 404, router will call next app with matching mount path.
If no apps with matching path return non-404 response, router will return the 404 of the last app.

Update: configure cascade codes: #1471 (comment)

@namusyaka

This comment has been minimized.

Show comment
Hide comment
@namusyaka

namusyaka Oct 23, 2013

Member

Perhaps, rack-protection is the cause of problem.
if change padrino-core.gemspec (>= 1.5.0 to = 1.5.0), it works.

Member

namusyaka commented Oct 23, 2013

Perhaps, rack-protection is the cause of problem.
if change padrino-core.gemspec (>= 1.5.0 to = 1.5.0), it works.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Oct 23, 2013

Member

Thanks for the tip! I updated the bundle on my machine and got this failure.

So, rack-protection >= 1.5.1 breaks this feature: f1e989f #1391

The last successful Travis build was with rack-protection 1.5.0 https://travis-ci.org/padrino/padrino-framework/jobs/12674078#L274

Member

ujifgc commented Oct 23, 2013

Thanks for the tip! I updated the bundle on my machine and got this failure.

So, rack-protection >= 1.5.1 breaks this feature: f1e989f #1391

The last successful Travis build was with rack-protection 1.5.0 https://travis-ci.org/padrino/padrino-framework/jobs/12674078#L274

@namusyaka

This comment has been minimized.

Show comment
Hide comment
@namusyaka

namusyaka Oct 23, 2013

Member

Looks great!

Member

namusyaka commented Oct 23, 2013

Looks great!

@Ortuna

This comment has been minimized.

Show comment
Hide comment
@Ortuna

Ortuna Oct 24, 2013

Member

Would this cascade to the next app if the first explicitly returns 404? That may not be desired(maybe an edge case). e.g. route is matched in app #1 but 404 is returned.

Member

Ortuna commented Oct 24, 2013

Would this cascade to the next app if the first explicitly returns 404? That may not be desired(maybe an edge case). e.g. route is matched in app #1 but 404 is returned.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Oct 24, 2013

Member

Well, that's how cascading is defined in Rack http://rack.rubyforge.org/doc/classes/Rack/Cascade.html

Member

ujifgc commented Oct 24, 2013

Well, that's how cascading is defined in Rack http://rack.rubyforge.org/doc/classes/Rack/Cascade.html

@Ortuna

This comment has been minimized.

Show comment
Hide comment
@Ortuna

Ortuna Oct 24, 2013

Member

got it, just wondering.

Member

Ortuna commented Oct 24, 2013

got it, just wondering.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Oct 24, 2013

Member

I guess, it won't hurt to add configurable status code. On it.

Member

ujifgc commented Oct 24, 2013

I guess, it won't hurt to add configurable status code. On it.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Oct 24, 2013

Member

You can configure HTTP codes for cascade apps like this:

config/apps.rb:

Padrino.mount("API").to('/foo')
Padrino.mount("Blocker", :cascade => [403]).to('/foo')
Padrino.mount("Application", :cascade => false).to('/foo')
Padrino.mount("LastResort").to('/foo')

In this case the request will pass API on it's 404 and 405 (default pass codes), will pass Blocker on it's 403, won't get to LastResort, it will end on Application.

Member

ujifgc commented Oct 24, 2013

You can configure HTTP codes for cascade apps like this:

config/apps.rb:

Padrino.mount("API").to('/foo')
Padrino.mount("Blocker", :cascade => [403]).to('/foo')
Padrino.mount("Application", :cascade => false).to('/foo')
Padrino.mount("LastResort").to('/foo')

In this case the request will pass API on it's 404 and 405 (default pass codes), will pass Blocker on it's 403, won't get to LastResort, it will end on Application.

@dariocravero

This comment has been minimized.

Show comment
Hide comment
@dariocravero

dariocravero Oct 24, 2013

Contributor

This looks very good @ujifgc 👍! :)

Contributor

dariocravero commented Oct 24, 2013

This looks very good @ujifgc 👍! :)

@Ortuna

This comment has been minimized.

Show comment
Hide comment
@Ortuna

Ortuna Oct 24, 2013

Member

👍

Member

Ortuna commented Oct 24, 2013

👍

ujifgc added a commit that referenced this pull request Oct 25, 2013

Merge pull request #1471 from padrino/cascade-apps
Introduce mounting cascade apps

@ujifgc ujifgc merged commit eab583a into master Oct 25, 2013

1 check passed

default The Travis CI build passed
Details

@ujifgc ujifgc deleted the cascade-apps branch Oct 25, 2013

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 25, 2013

Member

Awesome, nice work @ujifgc. Padrino 0.12.0 is coming along fast with all your guys great contributions. Only 22 open issues. Great work @padrino/core-members!

Member

nesquena commented Oct 25, 2013

Awesome, nice work @ujifgc. Padrino 0.12.0 is coming along fast with all your guys great contributions. Only 22 open issues. Great work @padrino/core-members!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment