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

Handle automatic redirect after switching to hash based history #3279

Closed
robertsLando opened this issue Sep 12, 2023 · 3 comments · Fixed by #3308
Closed

Handle automatic redirect after switching to hash based history #3279

robertsLando opened this issue Sep 12, 2023 · 3 comments · Fixed by #3308

Comments

@robertsLando
Copy link
Member

Ref: #3267

@kpine
Copy link
Contributor

kpine commented Oct 4, 2023

This seems to have only been fixed in a very limited use case. Accessing an old URL can still fail with 500 Internal Server Error:

Oct 04 14:05:13 zui[1573243]: TypeError: Cannot read properties of undefined (reading 'replace')
Oct 04 14:05:13 zui[1573243]:     at /usr/src/app/server/app.js:448:51
Oct 04 14:05:13 zui[1573243]:     at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
Oct 04 14:05:13 zui[1573243]:     at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:328:13)
Oct 04 14:05:13 zui[1573243]:     at /usr/src/app/node_modules/express/lib/router/index.js:286:9
Oct 04 14:05:13 zui[1573243]:     at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:346:12)
Oct 04 14:05:13 zui[1573243]:     at next (/usr/src/app/node_modules/express/lib/router/index.js:280:10)
Oct 04 14:05:13 zui[1573243]:     at /usr/src/app/node_modules/connect-history-api-fallback/lib/index.js:85:5
Oct 04 14:05:13 zui[1573243]:     at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
Oct 04 14:05:13 zui[1573243]:     at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:328:13)
Oct 04 14:05:13 zui[1573243]:     at /usr/src/app/node_modules/express/lib/router/index.js:286:9

The code seems to assume a request will always contain the X-External-Path header, which isn't the case if you a) aren't using a proxy, or b) using a proxy but not using a subpath.

@robertsLando
Copy link
Member Author

@kpine fixed on master. I originally made tests without proxy and it worked, then I added the header check too with the proxy and forgot to test without again. Thanks for the feedback, test master if/when you can

@kpine
Copy link
Contributor

kpine commented Oct 5, 2023

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants