Skip to content

API broken with reverse proxy setup #1496

@vladaurosh

Description

@vladaurosh

What installation are you running?

Production (netalertx) 📦

Is there an existing issue for this?

The issue occurs in the following browsers. Select at least 2.

  • Firefox
  • Chrome
  • Edge
  • Safari (unsupported) - PRs welcome
  • N/A - This is an issue with the backend

Current Behavior

Homepage app widget stopped working after upgrade to v26.2.6, with error:
error: <credentialedProxyHandler> HTTP Error 403 calling https://netalertx.example.com/server/devices/totals

Backend API URL is set to https://netalertx.example.com/server

Tried:
curl 'https://netalertx.example.com/server/devices/totals' -H 'Authorization: Bearer MYTOKEN'
and got:

<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

Also:
curl 'http://127.0.0.1:20212/devices' -H 'Authorization: Bearer MYTOKEN'
does not work, returns:
{"error":"Forbidden","message":"ERROR: Not authorized","success":false}

What is working:

curl 'http://127.0.0.1:20212/graphql' \
  -X POST \
  -H 'Authorization: Bearer MYTOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "query": "query GetDevices($options: PageQueryOptionsInput) { devices(options: $options) { devices { rowid devMac devName devOwner devType devVendor devLastConnection devStatus } count } }",
    "variables": {
      "options": {
        "page": 1,
        "limit": 10,
        "sort": [{ "field": "devName", "order": "asc" }],
        "search": "",
        "status": "connected"
      }
    }
  }'

So I know my token is ok.

Also /php/server/query_json.php?file=app_state.json works fine with the token,

Expected Behavior

APIs should work.

Steps To Reproduce

N/A

Relevant app.conf settings

N/A

docker-compose.yml

N/A

Debug or Trace enabled

  • I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.

Relevant app.log section

  PASTE LOG HERE. Using the triple backticks preserves format.

Docker Logs

  PASTE DOCKER LOG HERE. Using the triple backticks preserves format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Waiting for reply⏳Waiting for the original poster to respond, or discussion in progress.bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions