1

I am all in favour of progressive enhancement and using server-side rendering when fetching a URL. The age-old discussion gives several advantages, such as improved load time, SEO crawling and possibly an improved level of "correctness"...etc

However I am getting my doubts as to why I am also setting up my server-side to handle form submits (i.e. a native HTML form being submitted to the server).

While my question is generic, the technology stack I am using is a Universal React + Redux application connecting to a third-party API. Therefore when JavaScript is disabled the server-side connects to the API to retrieve or POST data, while when JavaScript is enabled the user's browser connects to the API directly.

What are the advantages in handling server-side POST or when should it be a priority?

10
  • We don't know what your application does. Is there security required? Data integrity required? Commented Jan 26, 2018 at 18:39
  • The application in question is an authenticated back office, similar to a CRM; however I am looking at the generic application. I updated the question with some details of the implementation. Commented Jan 26, 2018 at 19:10
  • Are you familiar with the properties Idempotent, safe and cacheable? HTTP methods
    – Laiv
    Commented Jan 26, 2018 at 19:52
  • Therefore when JavaScript is disabled the server-side connects to the API to retrieve or POST data, while when JavaScript is enabled the user's browser connects to the API directly. -- Doesn't that answer the question you posed? Commented Jan 26, 2018 at 20:10
  • 2
    I don't know. Only you can answer that question. As recently as a couple of years ago, some developers were still worrying about supporting Internet Explorer 6. Commented Jan 26, 2018 at 22:15

1 Answer 1

-1

One use case where server-side is necessary is when the POST response is a format which is not supported by the client, such as an ODF or ePub document. In order to download the file, submitting the data is required.

The first parameter in the HTTP context is either inline (default value, indicating it can be display inside the Web page, or as the Web page) or attachment (indicating it should be downloaded; most browsers presenting a 'Save as' dialog, prefilled with the value of the filename parameters if present).

Content-Disposition: inline
Content-Disposition: attachment
Content-Disposition: attachment; filename="filename.odf"

References

2
  • You can actually initiate a download from JS and specify the request to be made with http method and everything else
    – marstato
    Commented Sep 8, 2018 at 7:15
  • @marstato As you can see in either the POST or GET based API requests, the response requires an additional step to download. Commented Sep 9, 2018 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.