Hello,
I am using App Search instance and a user interface based on elastic SearchUi example. I am reverse proxying the node.js app and the connections to the App Search API with Apache2.
I cannot get this to work. I get the error message:
An unexpected error occurred: Cannot read property 'forEach' of undefined
I think this means that the search payload is not getting through but I am not 100% positive.
Hey @turekg,
Are you seeing that error in your node.js app, or in the browser?
It shows in the browser, I am assuming it's getting passed back from the server.
The relevant bit of my proxy setup are:
SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Credentials false
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS"
Header always set Access-Control-Allow-Headers "Accept, authorization, content-type, Host, Origin, x-swiftype-client, x-swiftype-client-version, x-swiftype-integration, x-swiftype-integration-version"
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
ProxyPass / https://127.0.0.1:5000/
ProxyPass /api/ https://127.0.0.1:3200/
ProxyPassReverse / https://127.0.0.1:5000/
ProxyPassReverse /api/ https://127.0.0.1:3200/
Can you inspect the API request in the browser's Network panel and see what the payload looks like in the response?
The url is https://fiji-search.mpi-cbg.de/, and it is probably simpler if you inspect yourself.
Your API request is returning a text/html webpage:
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><link rel="shortcut icon" href="/favicon.ico"/><title>Gitter Search</title><link href="/static/css/main.0ac613d8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" class="app-container"></div><script src="/static/js/main.2287eacc.js"></script></body></html>
OK, so where is it going wrong?
So the problem was in the order of the the proxy calls, argh!
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.