Proxying gdbgui with nginx produces a SocketIO cors_allowed_origins error resulting in a broswer 400 error.
- Dominant language
- TypeScript
- Stars
- 10.4k
- Forks
- 521
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When proxying gdbgui connections, gdbgui reports
```
https://my-dev-server.tld:8443 is not an accepted origin. (further occurrences of this error will be logged with level INFO)
```
That is a low level SocketIO error message from EngineIO (iiuc).
**To Reproduce**
1. Create nginx.conf listening on port 8443 with these locations:
```
location /debug/static {
alias /usr/local/lib/python3.8/dist-packages/gdbgui/static;
}
location /socket.io/ {
proxy_pass http://127.0.0.1:50000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header Host "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /debug {
proxy_pass http://127.0.0.1:50000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
client_max_body_size 100M;
}
```
2.
```
gdbgui -p 50000 -r --host="yoursite.tld" --gdb-cmd="sudo gdb -p `pidof atd`"
```
3. Navigate in your browser to https://yoursite.tld/debug, open F12 console and look for failed socket.io POST messages.
4. Notice logged message from the window where gdbgui was launched
```
Warning: authentication is recommended when serving on a publicly accessible IP address. See gdbgui --help.
View gdbgui at http://10.17.0.14:50000
View gdbgui dashboard at http://10.17.0.14:50000/dashboard
exit gdbgui by pressing CTRL+C
https://yoursite.tld:8443 is not an accepted origin. (further occurrences of this error will be logged with level INFO)
```
**Expected behavior**
SocketIO() calls need a cors_allowed_origins parameter that matches the gdbgui "--host" cmdline parameter.
**Please complete the following information:**
* OS: Ubuntu Focal
* gdbgui version (`gdbgui -v`): 0.15.0.1
* gdb version (`gdb -v`): GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
* browser [e.g. chrome, safari]: Firefox
* python packages (`pip freeze`):
acme==1.1.0
attrs==19.3.0
Automat==0.8.0
awscli==1.18.69
bidict==0.21.3
blinker==1.4
botocore==1.16.19
breezy==3.0.2
Brotli==1.0.9
certbot==0.40.0
certifi==2019.11.28
chardet==3.0.4
click==8.0.1
cloud-init==21.4
colorama==0.4.3
command-not-found==0.3
ConfigArgParse==0.13.0
configobj==5.0.6
constantly==15.1.0
cryptography==2.8
dbus-python==1.2.16
Deprecated==1.2.7
devscripts===2.20.2ubuntu2
distro==1.4.0
distro-info===0.23ubuntu1
docutils==0.16
dulwich==0.19.15
entrypoints==0.3
fastimport==0.9.8
Flask==2.0.1
Flask-Compress==1.10.1
Flask-SocketIO==5.1.1
future==0.18.2
gdbgui==0.15.0.1
ghp-import==2.0.2
gpg===1.13.1-unknown
httplib2==0.14.0
hyperlink==19.0.0
idna==2.8
importlib-metadata==4.9.0
incremental==16.10.1
itsdangerous==2.0.1
Jinja2==3.0.1
jmespath==0.9.4
josepy==1.2.0
jsonpatch==1.22
jsonpointer==2.0
jsonschema==3.2.0
keyring==18.0.1
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.3
Markdown==3.3.6
MarkupSafe==2.0.1
mergedeep==1.3.4
mkdocs==1.2.3
mkdocs-material==8.1.3
mkdocs-material-extensions==1.0.3
mock==3.0.5
more-itertools==4.2.0
netifaces==0.10.4
oauthlib==3.1.0
olefile==0.46
packaging==21.3
parsedatetime==2.4
pathspec==0.7.0
pbr==5.4.5
pexpect==4.6.0
Pillow==7.0.0
pyasn1==0.4.2
pyasn1-modules==0.2.1
pygdbmi==0.10.0.1
PyGithub==1.43.7
Pygments==2.10.0
PyGObject==3.36.0
PyHamcrest==1.9.0
PyICU==2.4.2
PyJWT==1.7.1
pymdown-extensions==9.1
pyOpenSSL==19.0.0
pyparsing==3.0.6
pyRFC3339==1.1
pyrsistent==0.15.5
pyserial==3.4
python-apt==2.0.0+ubuntu0.20.4.7
python-dateutil==2.8.2
python-debian===0.1.36ubuntu1
python-engineio==4.2.1
python-gitlab==2.0.1
python-magic==0.4.16
python-socketio==5.4.0
pytz==2019.3
pyxdg==0.26
PyYAML==5.3.1
pyyaml-env-tag==0.1
requests==2.22.0
requests-toolbelt==0.8.0
requests-unixsocket==0.2.0
roman==2.0.0
rsa==4.0
s3transfer==0.3.3
SecretStorage==2.3.1
service-identity==18.1.0
simplejson==3.16.0
six==1.14.0
sos==4.3
ssh-import-id==5.10
systemd-python==234
Twisted==18.9.0
ubuntu-advantage-tools==27.6
ufw==0.36
unattended-upgrades==0.1
unidiff==0.5.5
urllib3==1.25.8
wadllib==1.3.3
watchdog==2.1.6
Werkzeug==2.0.1
wrapt==1.11.2
yamllint==1.20.0
zipp==1.0.0
zope.component==4.3.0
zope.event==4.4
zope.hookable==5.0.0
zope.interface==4.7.1
**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
Start by locating the SocketIO() initialization and the command-line handling for gdbgui's --host option. Reproduce the failure with the supplied nginx configuration and Firefox, then verify that the proxied Socket.IO connection accepts the configured origin instead of returning a browser 400 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, nginx, python
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100