reactjs - react.router pathname does not appear to be affected by reverse-proxy changing URL -
i have code using react-router sits behind nginx proxy. i'm running test code on dev server within npm. nginx config on proxy server, should redirect test server looks this:
location: /testserver/myapp/ { proxy_pass http://1.3.3.7:3000/; }
as understand should replace upto , including /testserver/myapp/ http address. http:/proxy/testserver/myapp/reactboilerplatedll should redirect http://1.3.3.7:3000/reactboilerplatedll. seems work, reactboilerplatedll @ top level on server (http://1.3.3.7:300/reactboilerplatedll) , loads correctly.
however, within routes.js printed out location code (forgive typos, retyped hand):
export default funciton createroutes(store) { const baseurl = config.baseurl; const path = '${baseurl}(/:deployment)'; return [{ path, name: 'home', getcomponenent(nextstate, cb){ alert(nextstate.locaiton.pathname)); .... (all other code, not relevant now) }]; }
now when hit http://proxy/testserver/myapp/deployment1 alert value testserver/myapp/deployment1. confuses me, expect testserver/myapp stripped off proxy_pass , never show in path.
is there reason still shows up? don't know how reactrouter resolving pathname, use $host header?
Comments
Post a Comment