{"id":18779431,"url":"https://github.com/zostay/raku-crox-http-fallbackpassthru","last_synced_at":"2025-06-22T19:07:31.405Z","repository":{"id":66558036,"uuid":"158012456","full_name":"zostay/raku-CroX-HTTP-FallbackPassthru","owner":"zostay","description":"Middleware to perform dumb passthru proxying","archived":false,"fork":false,"pushed_at":"2020-02-08T16:26:08.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-22T19:06:43.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zostay.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-17T18:22:20.000Z","updated_at":"2021-05-14T15:57:58.000Z","dependencies_parsed_at":"2023-05-31T15:01:10.133Z","dependency_job_id":null,"html_url":"https://github.com/zostay/raku-CroX-HTTP-FallbackPassthru","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zostay/raku-CroX-HTTP-FallbackPassthru","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2Fraku-CroX-HTTP-FallbackPassthru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2Fraku-CroX-HTTP-FallbackPassthru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2Fraku-CroX-HTTP-FallbackPassthru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2Fraku-CroX-HTTP-FallbackPassthru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zostay","download_url":"https://codeload.github.com/zostay/raku-CroX-HTTP-FallbackPassthru/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2Fraku-CroX-HTTP-FallbackPassthru/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261348748,"owners_count":23145312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T20:20:03.564Z","updated_at":"2025-06-22T19:07:26.392Z","avatar_url":"https://github.com/zostay.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n====\n\nCroX::HTTP::FallbackPassthru - dumb passthru proxy middleware for Cro\n\nSYNOPSIS\n========\n\n    use Cro::HTTP::Router;\n    use Cro::HTTP::Server;\n    use CroX::HTTP::FallbackPassthrue;\n\n    my $application = route { ... };\n    my $fallback = CroX::HTTP::FallbackPassthru.new(\n        forward-uri =\u003e Cro::Uri.parse('http://localhost:12345'),\n    );\n\n    my Cro::Service $service = Cro::HTTP::Server.new(\n        host        =\u003e 'localhost',\n        port        =\u003e 8080,\n        application =\u003e $application,\n        after       =\u003e ($fallback,),\n    );\n\n    $service.start;\n\nDESCRIPTION\n===========\n\nYou should probably only ever use this in development. In production there are smarter ways to do reverse proxying. However, if you need a dumb reverse proxy during development, this can do it.\n\nBasically, this is Cro middleware that will try to forward the request on to another server when the router for this application returns a 404. The forwarding is done by making a client call from this server to the forwarded server using the same request object. The response from the client is then passed back through.\n\nMETHODS\n=======\n\nIn case you have some need to extend the middleware, here's a description of the methods.\n\nmethod forward-uri\n------------------\n\n    has Cro::Uri $.forward-uri\n\nThis is the URI of the passthrough service.\n\nmethod should-fallback\n----------------------\n\n    method should-fallback(Cro::HTTP::Response $res -\u003e Bool)\n\nGiven a response, this determines if fallback to the proxied service should be performed. The default implementation just checks to see if the response status is 404 and returns True in that case. It returns False in all others.\n\nmethod client-uri\n-----------------\n\n    method client-uri(Cro::HTTP::Request $req -\u003e Cro::Uri)\n\nGiven a request, it creates the URI that should be contacted to perform the passthru proxying. This is done by appending the path and query of the request to this server to the URI returned by [method forward-uri](#method forward-uri).\n\nmethod process\n--------------\n\n    method process(Supply $responses --\u003e Supply)\n\nThis is the method that puts it altogeher.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzostay%2Fraku-crox-http-fallbackpassthru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzostay%2Fraku-crox-http-fallbackpassthru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzostay%2Fraku-crox-http-fallbackpassthru/lists"}