Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

something went wrong while being behind Apache reverse proxy #61

Open
tassoman opened this issue Nov 15, 2019 · 2 comments
Open

something went wrong while being behind Apache reverse proxy #61

tassoman opened this issue Nov 15, 2019 · 2 comments

Comments

@tassoman
Copy link

tassoman commented Nov 15, 2019

While loading the web interface I got a 404 error "something went wrong" because browser can't load /api/settings neither /api/agent resources.

Settings are missing and Agents can't be loaded because resorces are served at: /nlp/api/settings and /nlp/api/agent

File swagger2.json is correctly loaded from: /nlp/swagger2.json

Steps to reproduce the behavior:

  1. Configure ssl with self-signed certs
  2. Configure apache to reverse proxy /nlp/ url
ProxyRequests Off
ProxyPass /nlp/ http://localhost:3010/
ProxyPassReverse /nlp/ http://localhost:3010/
<Location /nlp/>
        ProxyPassReverse /
        ProxyHTMLEnable On
        ProxyHTMLURLMap http://localhost:3010/ /nlp/
        ProxyHTMLURLMap / /nlp/
        RequestHeader unset Accept-Encoding
</Location>
  1. Configure client/.env like this
# ENV to generate public
# npm run build
SETTINGS_URL=https://remote.host/nlp
API_URL=https://remote.host/nlp
PUBLIC_PATH_PREFIX=.
  1. Open web interface and browser console
  2. See error

Mixed Content: The page at 'https://remote.host/nlp/api' was loaded over HTTPS, but requested an insecure resource 'http://remote.host/api/settings'. This request has been blocked; the content must be served over HTTPS.

I expected the interface were looking for /nlp/api/settings and /nlp/api/agent resources, where resource really are. Looks like SETTINGS_URL and API_URL are ignored.

@ericzon
Copy link
Contributor

ericzon commented Nov 28, 2019

To reflect changes made in client/.env you need to rebuild as frontend don't work with env variables by default. This generates build and this content is served in public folder on the root.

Something like that:

Modify client/.env
npm run build
cd ../
rm -rf public
mv client/build public

@tassoman
Copy link
Author

Thank you @ericzon for reply. That's what I did. I rebuilt using parameters I've described in step 3. Looks like this was not enough because /api/settings & /api/agent weren't rewritten although are now served at /nlp/api/settings & /nlp/api/agent.
/nlp is my proxy mount point.

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

2 participants