File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,31 @@ async def proxbox_tag():
100
100
#netbox_url
101
101
]
102
102
103
+ # Get all NetBox endpoints and build CORS origins list - The following code was generated by Cursor.
104
+ netbox_endpoints = NetBoxEndpoint .objects .all ()
105
+ origins = []
106
+
107
+ for endpoint in netbox_endpoints :
108
+ # Build protocol based on verify_ssl
109
+ protocol = "https" if endpoint .verify_ssl else "http"
110
+
111
+ # Add both HTTP and HTTPS origins for each domain
112
+ origins .extend ([
113
+ f"{ protocol } ://{ endpoint .domain } " ,
114
+ f"{ protocol } ://{ endpoint .domain } :80" ,
115
+ f"{ protocol } ://{ endpoint .domain } :443" ,
116
+ f"{ protocol } ://{ endpoint .domain } :8000"
117
+ ])
118
+
119
+ # Add default development origins
120
+ origins .extend ([
121
+ "https://127.0.0.1:443" ,
122
+ "http://127.0.0.1:80" ,
123
+ "http://127.0.0.1:8000"
124
+ ])
125
+
126
+
127
+
103
128
app .add_middleware (
104
129
CORSMiddleware ,
105
130
allow_origins = ['*' ],
You can’t perform that action at this time.
0 commit comments