Swagger API Docs not working #387

Closed
opened 2025-12-29 16:21:34 +01:00 by adam · 5 comments
Owner

Originally created by @troxil on GitHub (Aug 24, 2016).

http://ipam.domain.tld:8081/api/docs/
Can't read from server. It may not have the appropriate access-control-origin settings.

I think Rest swagger doesn't support custom ports (8081) because when I access the URL above and hit "Explore" it changes the URL in the box to http://ipam.domain.tld/api/docs/api-docs/

http://ipam.domain.tld:8081/api/docs/api-docs/ loads with the required JSON data that the swagger UI would use. Overriding the box with this URL does not work and reverts back to the above failing URL.

Originally created by @troxil on GitHub (Aug 24, 2016). http://ipam.domain.tld:8081/api/docs/ Can't read from server. It may not have the appropriate access-control-origin settings. I think Rest swagger doesn't support custom ports (8081) because when I access the URL above and hit "Explore" it changes the URL in the box to http://ipam.domain.tld/api/docs/api-docs/ http://ipam.domain.tld:8081/api/docs/api-docs/ loads with the required JSON data that the swagger UI would use. Overriding the box with this URL does not work and reverts back to the above failing URL.
adam closed this issue 2025-12-29 16:21:34 +01:00
Author
Owner

@troxil commented on GitHub (Aug 24, 2016):

I edited the base_path in settings.py to reflect my custom port (8081) and it works now.
I suspect it might easier to use whatever was requested by the client, instead of this base_path?

@troxil commented on GitHub (Aug 24, 2016): I edited the base_path in settings.py to reflect my custom port (8081) and it works now. I suspect it might easier to use whatever was requested by the client, instead of this base_path?
Author
Owner

@troxil commented on GitHub (Aug 24, 2016):

Also I do notice now that also the "Try it Out!" buttons reference port 80. Not sure where that's defined yet.

@troxil commented on GitHub (Aug 24, 2016): Also I do notice now that also the "Try it Out!" buttons reference port 80. Not sure where that's defined yet.
Author
Owner

@rfdrake commented on GitHub (Aug 31, 2016):

I've uploaded a couple of commits. One with just the base_path change which hopefully will be usable by anyone, and another that was experimental to try out django swagger 2.0.5.

@troxil, for your purpose I believe your best bet is going to be running a proxy in front of netbox that changes 80->8081. That's the recommended method of getting things done, but maybe you've got a situation where you can't do that.

@rfdrake commented on GitHub (Aug 31, 2016): I've uploaded a couple of commits. One with just the base_path change which hopefully will be usable by anyone, and another that was experimental to try out django swagger 2.0.5. @troxil, for your purpose I believe your best bet is going to be running a proxy in front of netbox that changes 80->8081. That's the recommended method of getting things done, but maybe you've got a situation where you can't do that.
Author
Owner

@jeremystretch commented on GitHub (Sep 27, 2016):

Going to close this out as I'm not sure there's anything really actionable here. However, please feel free to raise the issue on the mailing list if you'd like.

@jeremystretch commented on GitHub (Sep 27, 2016): Going to close this out as I'm not sure there's anything really actionable here. However, please feel free to raise the issue on the mailing list if you'd like.
Author
Owner

@skamithi commented on GitHub (Mar 10, 2017):

For folks using docker to install netbox and using the nginx->netbox model, and running into this error. implement the 2nd patch discussed in this ticket. The SWAGGER_SETTINGS was removed but as of 1.9.1, rfdrakes fix fixed the problem for me, so I added the code back in my fork :)

@skamithi commented on GitHub (Mar 10, 2017): For folks using docker to install netbox and using the nginx->netbox model, and running into this error. implement the 2nd patch discussed in this ticket. [The SWAGGER_SETTINGS was removed]( https://github.com/digitalocean/netbox/commit/5eb3c1a67b282af49e34e42495143d46685c059c) but as of 1.9.1, [rfdrakes fix](https://github.com/rfdrake/netbox/commit/06c83db3cf3ae1707f19158ff2ee20e8936bbb14) fixed the problem for me, so I added the code back in my fork :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#387