Comments (12)
Hmm just tested the first request does seem to be captured - it's only later requests that are cached that seems to be not captured.
from proxyman.
@tonyxiao It's expected behavior because fetch from NodeJS doesn't respect the system HTTP Proxy.
To capture the fetch
, you should use the Automatic Setup: https://docs.proxyman.io/automatic-setup/automatic-setup
It will open the pre-configured Terminal -> Start your NodeJS server here -> Proxyman will automatically capture all NodeJS request/response 👍
from proxyman.
I used the automatic set up and it still didn't work.
from proxyman.
That was in the title of the issue actually
from proxyman.
To be sure it works for if I just run a node script, the problem is when I try to run next.js it doesn't work
from proxyman.
Ah, it's a special case: from react server components in next.js
My initial is a fetch from NodeJS server. Let me see
from proxyman.
I guess it's because fetch
from NextJS is a custom version, and it ignores all system Proxy.
You should manually add the Proxy to the fetch
and trust the self-signed certificate. Here is the answer: https://stackoverflow.com/questions/72306101/make-a-request-in-native-fetch-with-proxy-in-nodejs-18
Proxyman can't capture it automatically because it's how NextJS works.
from proxyman.
I see. What is the underlying networking lib next js uses? And wouldn't proxyman hook into that?
Separately would you be able to create an example of how to use proxyman with next.js? Feels like it should be in the docs somewhere too.
from proxyman.
@NghiaTranUIT following up here. Would love to have an example that works with next.js and some better understanding why it doesn't work out of the box.
from proxyman.
Sure, I will do it this weekend 👍
from proxyman.
@tonyxiao turn out Proxyman can capture the fetch
from Server Side Component as soon as you don't use the caching.
- Start the Pre-configure Terminal on Tools -> Setup -> Automatic Setup
- Use
no-cache
onfetch
export default async function MyPage() {
const res = await fetch('https://httpbin.org/anything', { cache: 'no-cache' }) // no cache, or no request is sent to Proxyman
return <div>My Page{res.text()}</div>
}
- Start your NextJS server on this terminal
- Done ✅
from proxyman.
Interesting , I will give that a try. Strange why is that tho, as my request should hit a cache miss as it runs the first time, which apparently is not the same as "no-cache"?
from proxyman.
Related Issues (20)
- [BUG][Compose] Make a request to `localhost:3000` will stuck until the timeout HOT 1
- Windows10 When i close proxyman,System Proxy auto closed. HOT 3
- Activate License Key with External Proxy HOT 2
- DELETE method with no response body or cached methods do not appear under JSON filter. HOT 2
- Why u remove 3 proxyman dock icons? HOT 2
- SSL Handshake Failed When Using Proxyman with Modified Device Time HOT 6
- Does support override host file split by app HOT 1
- Proxyman incorrectly display header HOT 5
- Query value not decode at Query Panel. HOT 3
- Update "Try Proxyman macOS" on iOS
- SSL Handshake Failed on iOS 17.4 simulator HOT 3
- [iOS] Reorder the Map Local and Breakpoint Rules
- Executing multiple scripts HOT 1
- [UI/UX] Improve UI HOT 2
- Support "Copy as" for multiple Request Selection HOT 1
- Support: Copy as "Markdown Table" HOT 1
- Add support custom terminal like iterm2 for automatic setup HOT 6
- No traffic when using `rustls-tls` HOT 3
- Add ability to inspect Tailscale traffic HOT 3
- Why I cannot see OPTIONS requests in the list? 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 proxyman.