Skip to content
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

Proxy not working #709

Closed
ShinyChang opened this issue Sep 23, 2016 · 21 comments
Closed

Proxy not working #709

ShinyChang opened this issue Sep 23, 2016 · 21 comments
Milestone

Comments

@ShinyChang
Copy link

Expected behavior

fetch() should work correctly.

Actual behavior

I got 404 NOT FOUND.

Environment

create-react-app: v0.4.3
React-scripts: v0.4.3
Node: v4.4.7
npm: v3.8.3

Operating system:
Windows

image

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Have you restarted the development server after adding the proxy setting?

@ShinyChang
Copy link
Author

@gaearon yes, i did.

@ShinyChang
Copy link
Author

ShinyChang commented Sep 23, 2016

is there any way to checking proxy server?

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Can you publish both projects so I could take a look? Meaning both generated project and the server you are using.

Also, can you reproduce this with https://github.com/fullstackreact/food-lookup-demo?

@ShinyChang
Copy link
Author

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Can’t reproduce this on OS X so far:

screen shot 2016-09-23 at 12 44 23

I’ll give Windows a try later today.

@gaearon gaearon added this to the 0.5.0 milestone Sep 23, 2016
@ShinyChang
Copy link
Author

ShinyChang commented Sep 23, 2016

I restarted my computer, and it works fine now. Not sure what's happed.

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

¯_(ツ)_/¯

@gaearon gaearon closed this as completed Sep 23, 2016
@shime
Copy link
Contributor

shime commented Aug 31, 2017

Wow, this is interesting. Had the exact same problem and solved it by restarting a computer too. No idea what's going on here.

@nickredmark
Copy link

Just some info for other people landing here: for me proxy works with a simple curl request, but not when opening the url in the browser. It's the Accept text/html header.

@PhilTheAir
Copy link

@shime Could I restart your computer to solve my problem, thanks:) still struggling with this problem

@rikkertkoppes
Copy link

@nmaro

Just some info for other people landing here: for me proxy works with a simple curl request, but not when opening the url in the browser. It's the Accept text/html header.

That does seem to be the problem indeed. Having the same issue. How did you solve this?

@amritms
Copy link

amritms commented Dec 29, 2017

restarted computer but still not working..

@nickredmark
Copy link

@rikkertkoppes I didn't solve it - I needed to expose a REST api and calls to those routes with fetch or curl work, the only inconvenient is not being able to open them in a browser window.

@ghost
Copy link

ghost commented Feb 8, 2018

same problem here

@superjose
Copy link

According to this:

The development server will only attempt to send requests without a text/html accept header to the proxy.

Just in case...

@Sandersd
Copy link

For what it's worth, I was having the same issue and a restart did the trick for me as well. I did notice as my computer was shutting down, that I had still had my work server up and running on localhost:5000 (same port as my express app). I didn't get a chance to test if killing that would solve the issue without a restart but it's a possibility?

@miaojiuchen
Copy link

Same situation...I restart my mac and it works...hahaha

@henrisokka
Copy link

And one more happy computer restarter.

@ELI7VH
Copy link

ELI7VH commented Apr 27, 2018

wtf. why would restarting your computer work? can somebody get to the bottom of this? Is there some kind of caching that can help?

@vinaysangawar
Copy link

Late to the party but I tried to restart servers along with the computer itself and the proxy still wasn't working (getting 404s). I just changed my server and proxy (package.json) port from 5000 to 6000, restarted the servers, and it started working. If restarts aren't working, try changing the port number. Still not sure of the root cause though...

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests