@khalby786
Thanks for your help. I have now solved my problem.
I am not sure if it’s from the ‘User-Agent’ field, but I did that and also more importantly, I hardcoded my server API prefix in my GET and POST methods: https://tenzinhub-api.glitch.me/api
(Previously, as is the norm, my nuxt.config.js
file has proxy handler etc that automatically converts GET method URI to have the server URL prefix.)
I think Github Pages
being static-only hosting site is a major factor since imo the proxy handler creates the api endpoint at client side and redirects to the server side - Github Pages
may not support this imo.
(Edit: I missed prefixing server URL for one POST method and that gave me the 405 error again. I fixed it and that proves giving full server URL as prefix is really needed. The ‘User-Agent’ is also probably important, as I am using that here. no harm done)
My first update with the ‘User-Agent’ field didn’t immediately work, then I hardcoded my server URL prefix with the '/api'
, it could be that there was a delay and the fix could have been the 'User-Agent'
.
Anyways, one of these 2 fixed my problem. Now I can make more full-stack projects in the future. Thanks.
Reference: