Comments (10)
Keeping the host
header would make tapes specific to where talkback is running (port & host), which is not very useful.
What do you need the host header for?
from talkback.
The system I am working with extracts some information from the host header.
from talkback.
The host
removal only affects tape matching.
The request that will be made to the downstream service will contain its own host
header (set to the host
property with which you started talkback).
from talkback.
Right, but I can only set one host property when I start talkback and my requests use different host headers depending on the request.
from talkback.
Talkback only fronts one service at a time, since it wouldn't have information to know where to route a request in case of multiple hosts.
If you're making requests to multiple services and you want to front them with talkback, you should start one talkback instance per service.
Something like this:
const service1 = talback({
...baseOpts,
host: "https://my-service1.com",
port: 8081,
path: baseOpts.path + "/service1"
})
service1.start()
const service2 = talback({
...baseOpts,
host: "https://my-service2.com",
port: 8082,
path: baseOpts.path + "/service2"
})
service2.start()
from talkback.
That won't work because all requests are meant to be sent to the same service but with different host headers depending on the user whose data is being requested.
from talkback.
@ijpiantanida I believe @Floydjd is referring to https://github.com/ijpiantanida/talkback/blob/master/src/request-handler.ts#L125 where the host header is deleted during makeRealRequest
I'm debugging an issue whereby removing the host header causes a mismatch for signed requests (aws in this case) which includes the host header value in it's signing. I also looked into node-fetch, your upstream dependency, and found that it does not add a host header. However, according to Mozilla
A Host header must be sent in all HTTP/1.1 requests and serves may respond with 400 for any request that lacks a host header
(source)
I think the right thing to do is maybe to overwrite the host header if it is not set to be the options.host
: #51
I can't think of a reason that we wouldn't want a host header in this request under any circumstances. WDYT?
from talkback.
node-fetch
should be adding the host header.
I locally aliased mystrangedomain.com to localhost.
What host
option are you giving to talkback?
from talkback.
@ijpiantanida Thanks for looking into this so quickly. You are right! I tested from the fetch side but didn't consider that node http
is actually setting the host. Once I checked from the server side as you did I saw the host there.
Theoretically, deleting the host header should work! I'm not sure why it does not but I will debug some more.
from talkback.
@ijpiantanida I must have made a mistake with a local modified version of talkback. deleting the host header works fine 😬 thank you, again.
from talkback.
Related Issues (20)
- Error when trying to connect to an https with self-signed certificate HOT 1
- Key order matters when comparing requests HOT 3
- It would be great for Talkback to gain an optional mode of operation that's compatible with Servirtium
- Match headers HOT 1
- Feature / Idea(s): Expose lower level APIs HOT 4
- Multiple hosts support? HOT 7
- Requests fail on Node v15.2.1 HOT 4
- Question: Can users add arbitrary properties to `meta`? HOT 2
- How to stop the server on CI? HOT 4
- Talkback could set a way to enforce req and res as humanReadable at options HOT 5
- Potential Feature Request: Consider only specific headers? HOT 2
- Disable header matching or provide a matcher HOT 1
- When starting multiple servers the logging does not use the server name provided in options HOT 2
- How to decode the body in request part of the tape? HOT 3
- TapeMatchers doesn't consider difference in protocol HOT 5
- Logo for talkback HOT 1
- bug: tapes aren't recorded with human readable body HOT 6
- ng-talkback vs talkback HOT 2
- Preserving the order of requests for each tests HOT 1
- Numbering can cause errors if previous tape was deleted HOT 2
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 talkback.