File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99ARG APP_ENV
1010ARG CLERK_SECRET_KEY
1111ARG CLIENT_URL
12+
1213COPY . .
1314RUN CGO_ENABLED=0 GOOS=linux go build -o /server ./cmd/server/
1415
Original file line number Diff line number Diff line change @@ -106,8 +106,8 @@ func main() {
106106 w .WriteHeader (http .StatusOK )
107107 fmt .Fprintln (w , "OK" )
108108 })
109-
110- check (http .ListenAndServe (httpAddress (), corsmiddleware .CORS (mux )))
109+ url := requiredEnv ( "CLIENT_URL" )
110+ check (http .ListenAndServe (httpAddress (), corsmiddleware .CORS (mux , url )))
111111
112112}
113113func check (err error ) {
Original file line number Diff line number Diff line change 11package middleware
22
3- import "net/http"
3+ import
4+ ("net/http"
5+
6+ )
7+
8+ func CORS (next http.Handler ,url string ) http.Handler {
49
5- func CORS (next http.Handler ) http.Handler {
610 return http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
711
8- w .Header ().Set ("Access-Control-Allow-Origin" , "http://localhost:5173" )
12+ w .Header ().Set ("Access-Control-Allow-Origin" , url )
913
1014 w .Header ().Set ("Access-Control-Allow-Credentials" , "true" )
1115
You can’t perform that action at this time.
0 commit comments