N
Nuxtβ€’2y ago
FiveDigitLP

POST to page returns 405 error

Hello! We have been working towards migrating our site from a C#/AngularJS hybrid to having a frontend driven by Vue/Nuxt with API calls to a backend written solely in C#. We have in-house desktop software that displays some of our web pages for use in the software (think about the way iTunes accesses its store). Previously, the software was able to navigate to the pages just fine, but after migrating to Vue/Nuxt we're getting a 405 error on certain ones. After talking with the software developers, it appears that the software is calling the pages with POST. Is there a problem in Nuxt with this to where we need to handle it differently? To further confirm our suspicions, I tried navigating to the page directly with the software's internal browser (versus the integrated web views it's using otherwise). That browser appears to use GET to make the call and has no trouble loading the pages. Any ideas on how to get this to work? We're thinking we're going to need to write some sort of request handler for these pages, but I just want to make sure that is the right path and not overkill.
12 Replies
warflash
warflashβ€’2y ago
I'd first try looking if there's a pattern for which pages throw the 405. Some working and some don't sound suspicious to me
FiveDigitLP
FiveDigitLPOPβ€’2y ago
Right. I think that's a bit of a red herring. I was trying to exclude unnecessary details initially, but as I wrote the message I ended up referencing what those pages are. To be more specific, the pages that do work are the ones that are navigated to through the internal browser. This includes general public pages on our site and the pages that are built to look like they're part of the software--but again in this case they're being accessed via this internal browser instead of using the web views that are supposed to give the appearance that these pages are not web but instead integrated pieces of the software. I hope I'm clear here. It's a bit of a muddy process, to be honest.
dmarr
dmarrβ€’2y ago
you'll get a 405 if you try to readBody(event) on a GET
FiveDigitLP
FiveDigitLPOPβ€’2y ago
To my knowledge, we're not trying to read the body with a GET request. As far as I can tell, it's just a POST request that doesn't seem to go through.
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
FiveDigitLP
FiveDigitLPOPβ€’2y ago
Also, if it's of any use to people trying to assist us, we're using an Azure SWA. We've started to wonder if that could be contributing to this issue.
πŸ‡¨πŸ‡­ Marko Bolliger <cannap>
code for the requests?
FiveDigitLP
FiveDigitLPOPβ€’2y ago
I'm sorry? Are you asking what is the code that is making the POST requests? If so, I unfortunately can't get that right now as it's our software team's code and I don't directly have access to it. That being said, any POST calls made to any directory outside of ~/server/api results in a 405
warflash
warflashβ€’2y ago
Have you guys tried a sample deploy on e.g. vercel to see if the error persists? ruling out azure as the cause
FiveDigitLP
FiveDigitLPOPβ€’2y ago
We've made calls with Postman and get the 405. We're actually trying Netlify right now! 😁 I attempted Vercel, but seems I don't have the right permissions on Azure DevOps (where our repo is at) We're getting good responses on Netlify!!!! Looks like an issue for this is going to need to be filled somewhere...
warflash
warflashβ€’2y ago
nice :hype:
FiveDigitLP
FiveDigitLPOPβ€’2y ago
In case anyone else struggles with this issue in the future, it does seem that this is an Azure issue and seemingly how they expect/intend for it to work: https://github.com/Azure/static-web-apps/issues/1132 https://learn.microsoft.com/en-us/azure/static-web-apps/apis-overview https://github.com/Azure/static-web-apps/issues/831
GitHub
Next.js Hybrid App returns 405 error for non-GET route handlers out...
Describe the bug It appears that there is a restriction on the allowed methods for API endpoints outside of a "/api" path in Next.js Hybrid Apps, causing any requests (out with GETs which...
Overview of API support in Azure Static Web Apps
Learn what API features Azure Static Web Apps supports
GitHub
Route matching appears to ignore methods Β· Issue #831 Β· Azure/stati...
Describe the bug I am attempting to use routes and files to simulate API calls. The documentation for application configuration contains the following rule for Routes: Rule evaluation stops at the ...
Want results from more Discord servers?
Add your server