You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/python3
import pynetbox
def main():
nb = pynetbox.api(url="netbox_url", token="my_netbox_token")
device = nb.dcim.devices.get(680)
print(device.render_config.create()["content"])
if __name__ == "__main__":
main()
Expected Behavior
It should return rendered context for device id 680.
Observed Behavior
Works fine when pointed directly to the netbox URL.
How ever when used with nginx reverse proxy it fails with:
Traceback (most recent call last):
File "/home/daniel.secik/./test2.py", line 11, in <module>
main()
File "/home/daniel.secik/./test2.py", line 8, in main
print(device.render_config.create()["content"])
File "/usr/lib/python3.9/site-packages/pynetbox/core/endpoint.py", line 706, in create
req = Request(**self.request_kwargs).post(data)
File "/usr/lib/python3.9/site-packages/pynetbox/core/query.py", line 368, in post
return self._make_call(verb="post", data=data)
File "/usr/lib/python3.9/site-packages/pynetbox/core/query.py", line 258, in _make_call
raise RequestError(req)
pynetbox.core.query.RequestError: The requested url: <proxy_url>:8080/netbox/api/680//680/render-config/ could not be found.
We only saw this with render_config, other api calls work fine with proxy.
Works for me, but I have BASE_PATH set correctly in NetBox (= no rewrite on the first Nginx). If I set BASE_PATH = "" and use rewrite, then I get the same error.
Pynetbox uses internally the URLs that NetBox returns in the objects (the url attribute), so if NetBox doesn't know what is the client-accessible path, it cannot return correct URLs.
pynetbox version
v7.1.0
NetBox version
v3.6.3
Python version
3.9
Steps to Reproduce
Expected Behavior
It should return rendered context for device id 680.
Observed Behavior
Works fine when pointed directly to the netbox URL.
How ever when used with nginx reverse proxy it fails with:
We only saw this with render_config, other api calls work fine with proxy.
The text was updated successfully, but these errors were encountered: