Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PUT "ssl.json/123" throws http 500 error #13

Open
stooj opened this issue Sep 3, 2020 · 2 comments · Fixed by customerio/go-maxcdn#1 · May be fixed by #14
Open

PUT "ssl.json/123" throws http 500 error #13

stooj opened this issue Sep 3, 2020 · 2 comments · Fixed by customerio/go-maxcdn#1 · May be fixed by #14

Comments

@stooj
Copy link

stooj commented Sep 3, 2020

When I try to PUT an new SSL cert, the request fails with a HTTP 500

Snippet of code:

max.Verbose = true
form := url.Values{}
// ... populate form
targetURL := fmt.Sprintf("ssl.json/%s", certID)
var put maxcdn.Generic
res, err := max.Put(&put, targetURL, form)

Response

Response: HTTP/2.0 500 Internal Server Error                                                                                                                                                                       
Access-Control-Allow-Origin: *                                                                                                                                                                                     
Cache-Control: max-age=3600, must-revalidate                                                                                                                                                                       
Content-Type: application/json                                                                                                                                                                                     
Date: Thu, 03 Sep 2020 13:46:51 GMT                                                                                                                                                                                
Etag: 89335e0158b9691b9d4a61c4ec6309cf                                                                                                                                                                             
Server: nginx                                                                                                                                                                                                      
Vary: Accept-Encoding                                                                                                                                                                                              
X-Xrds-Location: http://rws.maxcdn.com/services.xrds                                                                                                                                                               
                                                                                                                                                                                                                   
{"code":500,"error":{"message":"Invalid signature","type":""}}
@stooj
Copy link
Author

stooj commented Sep 3, 2020

I believe this is because PUT forms are not being signed:

go-maxcdn/maxcdn.go

Lines 258 to 261 in 9f915d2

// Only post needs a signed form.
if method != "POST" {
form = nil
}

@stooj
Copy link
Author

stooj commented Sep 3, 2020

Merged into our master so we can use the fix right away, which incorrectly closed the issue. Sorry :(

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
1 participant