Comments (5)
You can do this now with onPreResponse
extension. Not as clean as a native extension to this module where you can specify an error handler fallback. But also not sure if it's worth the complexity here. I'll let @kanongil decide.
from inert.
Thanks for the help, that's exactly what I needed. There's a little bit of new route detection that I had to do, but it may actually be cleaner this way.
That could just be because my app is small right now however.
from inert.
I agree with the approach @hueniverse offered, though I would probably use a plain directory handler, and handle the proxy behavior in the onPreResponse
hook.
To detect when to apply this behavior, as the hook is called for all routes, you can use the app
route config, which can be accessed from the extension point handler via request.route.settings.app
.
I will leave this request open for now in case others want to chime in but I don't really think it is worth the effort to include this functionality in inert
.
from inert.
I did look at onPreResponse
I can't still say for sure why I didn't take that route, but I can say that I looked at it for a bit. I can say also that this proxy stuff is super helpful when injecting node.js into a stale corporate environment. Even if the application was small, it came together quick.
This app really tears the face off of a bad site, and it's gonna take a crowbar to get this sucker off.
from inert.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
from inert.
Related Issues (20)
- Action required: Greenkeeper could not be activated 🚨 HOT 1
- Update joi HOT 1
- I'm upgrading hapi from v16 to v17 and trying to register plugins but getting error as- AssertionError [ERR_ASSERTION]: Invalid plugin options HOT 1
- Problem with serving static file HOT 1
- Only node 12
- Require hapi 19
- Change plugin name to @hapi/inert
- 6.0.1 should be 7.0.0 because it required hapi 19 whereas 6.0.0 does not HOT 4
- @hapi/ammo - Denial of Service HOT 1
- Directory listings fail with a 500 when path is absolute HOT 1
- `redirectToSlash` not being applied HOT 2
- Add an option to prevent following symlinks HOT 6
- Allow path functions to be async HOT 10
- Add h.directory() toolkit decoration HOT 2
- Disabling `must-revalidate` when serving static files via Inert HOT 1
- Invalid "inert" server options issue after Hapi update to 20.2.2 : HOT 5
- Release Notes 7.0.0 HOT 3
- SVG files being served as text/plain instead of image/svg, how do I fix this?
- Error: Failed to open file: ENAMETOOLONG HOT 1
- Unit Tests are failing for @hapi/[email protected] HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inert.