Questions tagged [http]
HyperText Transfer Protocol - a textual system for representing web requests and replies.
377
questions
-3
votes
3
answers
140
views
Why does the HTTP protcol support multiple methods?
This is a question which I have had in the back of my mind for a significant length of time, but never found an answer to, and never thought to directly ask - until today.
I am interested to ...
-2
votes
1
answer
197
views
Go’s answer to c10k problem
I have few questions on the go's answer to c10K problem. How is an event loop different from the network poller described in this blog?
I see a striking similarity between waiting threads and waiting ...
1
vote
1
answer
207
views
What really is a "web server" in relation to popular frameworks like Flask, Node.js, Apache?
In Flask you can run a "webserver". Well really it's a "WSGI Server". Well really you shouldn't be using core server features like serving files through HTTP at all, you should be ...
0
votes
6
answers
174
views
Can a web server accept a plain test file upload without additional server side scripting?
I've been trying for days to upload plain text files to a web server (both IIS and NGINX) via HTTP PUT/POST, from a C# desktop app, unsuccessfully
However, I'm no further along. I have had various ...
0
votes
1
answer
106
views
When to use PUT vs POST while calling APIs?
GIST:
PUT is idempotent PUT is used for updating/creating a resource.
POST isn't idempotent. POST is used for creating a resource.
So, I'm wondering what should I use in this case and why?
I want to ...
0
votes
1
answer
96
views
HTTP redirect vs JS redirect
I have a Svelte web app exclusively for internal use, so there is no main landing page or registration, as accounts need to be created by the admin. Since the main page has no function as an ...
0
votes
3
answers
125
views
Is it appropriate to use PUT for resources when the id is deterministically derived from immutable properties?
I'm working with a RESTful API where a POST operation is used to create a user. A required field, which could be an email or a unique user nickname, is unique across the system. The response to this ...
0
votes
3
answers
491
views
How to combine epoll + multithreading in an HTTP server
I'm building an HTTP server in C using epoll and pthread. The idea is to have an event loop in the main thread monitoring file descriptor and a thread pool to handle computationally-expensive ...
-4
votes
1
answer
155
views
Web applications, cookies and GDPR
... or technology stack for compliant web applications.
GDPR among other includes cookies usage defining four cookie types: strictly necessary cookies , preferences cookies, statistics cookies, ...
1
vote
2
answers
137
views
Best way to protect action links from CSRF
An application has a multifactor login.
The user logs in with its e-mail and password, and then the following screen asks for a one time password received via e-mail or generated by a mobile app.
In ...
0
votes
0
answers
802
views
How inter-process communication is handled on .NET Core?
I have to implement a bi-directional communication between two local process with support to backward compatibility .NET Core/NET Framework and platform architecture x86/x64.
The options that i have ...
1
vote
3
answers
300
views
What sort of http error code to return when the request is bad AND there is an error on the server?
Some of the checks I make to validate http requests involve making a call to an external service to parse part of the request body. These calls can fail because of network connectivity issues. My ...
0
votes
1
answer
1k
views
How could creating symlinks/aliases to files on S3 work, while still taking advantage of CDN optimizations?
I am trying to imagine a website/system where only 1 copy of a file is ever stored, but multiple users get their own custom link to the file, and it uses the CDN features. For this question we can ...
1
vote
1
answer
235
views
Best practise for designing REST API endpoint that accepts a nested resource POST
What's the recommended design for an endpoint that accepts a nested resource as the following:
POST /account
{
"name": "Project John Doe",
"description": "...
4
votes
3
answers
1k
views
Error or not error?
I need to implement the following scenarios at the server:
User sent too many answers in a given amount of time, for example, it can't submit more than 3 posts within an hour.
User sent answer with ...
0
votes
1
answer
46
views
Handling resource not found
I have an endpoint GET home/{homeId}/laptops . Its response is :
{"homeId":string,"laptops":string[]}
If homeID does not exist I can return '404 Not found' OR an empty response ...
-2
votes
2
answers
3k
views
What are the possible *root causes* of a SocketTimeoutException?
I understand that a SocketTimeoutException (I'm in Java, but I guess it's the same in just about every major language) happens after a server or client doesn't respond after a period of time, let say ...
0
votes
0
answers
209
views
Returning header Location on POST with no content
I am designing an API that some operations may take a while, for example, creating a backup (not the actual case).
I am planning to have an endpoint to query the current job
http GET /api/v1/jobs/{...
1
vote
4
answers
2k
views
Design REST Polymorphic API
I have a client/server application that exposes data and commands through REST APIs. This API exposes a GET /recipes/:id endpoint that instructs the client on how to show a recipe. A recipe can be ...
0
votes
1
answer
255
views
Is it a good idea to have conditional sync/async HTTP API
The api has one endpoint with some parameters. Based on these parameters I can predict how long the processing of the request would take. It can go from seconds(s) to tens of seconds.
When expected ...
0
votes
3
answers
2k
views
Is a 422 response ever appropriate for a GET request?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422
The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content ...
2
votes
1
answer
1k
views
Does it make sense to add an additional REST API to access a database?
I've recently joined a startup that has, in my opinion, a strange (and inefficient) way to access their database.
Their implementation consists of multiple REST APIs that are exposed to multiple ...
-2
votes
1
answer
459
views
Should I use http status code 402 in my api specification for api methods that allow payment?
According to the MDN the http protocol has the 402 status code:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses
And is used for methods that require payment.
Also RFC ...
-1
votes
1
answer
566
views
Securing http communication between backend services [closed]
What is a good way to secure http communication between two backend services which are not hosted on the same network?
One way might be to have a shared secret in both services but I feel like that is ...
-1
votes
1
answer
137
views
Should micro services follow HTTP verbs precisely?
I'm concerned with the practices on my team regarding following REST and HTTP verbs precisely. For example, when we hit a get endpoint for a resource/resources that doesn't exist, we return a 404. ...
0
votes
2
answers
913
views
How can I do a GET for complex calculation when the amount of data required may be too large for a GET?
We have an internal library that does a calculation based on several datapoints. There is a fair bit of data required for the calculation, about 5kB in total. I'd like to make this an API endpoint for ...
0
votes
1
answer
717
views
How does resuming downloads work?
I have seen download managers manage to resume HTTP downloads from where they stopped. How are they able to resume downloads? Is it related to the Accept-Range Header? Or are there other mechanisms ...
-1
votes
2
answers
168
views
What are the benefits of HTTP statuses compared to custom JSON based protocol?
I am currently developing a service and a client and I use HTTP statuses for communicating certain info.
For example, I have a POST /vikings endpoint that starts a long running process to create a ...
1
vote
2
answers
172
views
REST HTTP Response code for a resource that the user is not authorised to access
Suppose user A creates a private resource at, for example, /books/somebooktitle
If user B attempts to access the resource at /books/somebooktitle what code should be returned?
HTTP403: Permission ...
3
votes
3
answers
414
views
Is a good practice reuse HTTP codes to encode something else?
As we know HTTP codes are used in HTTP response. Usually with this code we can have an idea about what happened. For example if I make a get request and I obtain a 404 I can figure out that the ...
1
vote
3
answers
490
views
Is the "archetype controller" really complies with REST architectural style
I've read the Fielding's thesis that defines the REST architectural style and noticed that the defined style appears to significantly conflicts with the so called "archetype controller", ...
1
vote
1
answer
141
views
How to implement UTM tracking correctly?
A GET should never change data on the server- use a POST request for that
I heard this recommendation countless times over the internet and always try my best to conform. But how should I implement ...
-1
votes
3
answers
145
views
What is the correct status code when serving different content than requested?
I'm working on a website that has different languages, being English the master language. Most of the site is fully translated but English content has a bigger team so it usually goes a bit ahead of ...
1
vote
1
answer
295
views
Advantages and disadvantages of including JS/CSS inside the HTML?
What are the advantages and disadvantages of including JS/CSS inside the HTML instead of separated files?
Specifically concerned about performance issues, for example, if the CSS and JS are small and ...
1
vote
1
answer
361
views
What is the correct architecture for communication between an HTTP server and a WS server on the same machine running in separate processes?
I have a Node.js HTTP REST API server and a Node.js WS server. I separated them into 2 entrypoints so that they can be more easily debugged and run separated from each other, but now I need the REST ...
0
votes
1
answer
296
views
How to properly notify a client from the server side in Golang (broadcasting)?
I'm working on a project which focuses on simple HTTP-related actions (to get my feet wet really). I'm using the net/http package, which I thought was very convenient for almost all requirements ...
0
votes
1
answer
214
views
How to design a rest api for updating collection(ArrayList) of Resource in Spring boot?
I have a resource called Client and it has the following attributes id, name, redirect URLs(ArrayList).
class Client{
int id;
String name;
List<String> redirectUrls;
}
I have all CRUD ...
0
votes
0
answers
89
views
Websockets or HTTP | B2B environment
Let's start off with the infrastructure architecture that we have, because that's the most important aspect of this conversation.
Clients (browsers) which communicate with the product cluster (over ...
-4
votes
2
answers
127
views
Does the HTTP specification fully define the semantics of request methods?
I see two possible interpretations of the semantics of request methods defined in the HTTP specification RFC 7231:
The intended effect of a request method is fully defined by the HTTP specification (...
0
votes
2
answers
211
views
A command as the intended effect of POST versus as the side effect of PUT
The intended effect (semantics) of the POST method is resource specific, e.g. executing a command with arguments:
POST /command HTTP/1.1
{"parameter-1": "argument-1", "...
1
vote
1
answer
284
views
Asynchronous HTTP request pattern
Here is the pattern that I thought about for a resource accepting a single asynchronous HTTP request at a time (i.e. a request which has not yet been fulfilled when the response is sent):
Create a ...
3
votes
3
answers
263
views
Can REST resources represent behaviour?
In the red book by V. Vernon it says about REST:
In RESTful HTTP, the methods are the HTTP verbs - most importantly, GET, PUT, POST, DELETE - that can be applied to resources.
Even though it might ...
2
votes
2
answers
558
views
Roy Fielding’s REST alternative to HTTP cookies
I struggle to understand Roy Fielding’s REST alternative to HTTP cookies, § 6.3.4.2 ‘Cookies’ and § 6.5.4.1 ‘Application State in a Network-Based System’ of his doctoral dissertation Architectural ...
1
vote
2
answers
1k
views
Long polling and message brokers
I was reading this article, and the author uses HTTP long polling to design a chat application.
I was wondering how does this compare with a dedicated Message Broker services like Apache Kafka, or ...
1
vote
1
answer
649
views
Best practice for deleting resource from web page
So I have been down the rabbit hole of finding that HTML forms don't support DELETE requests, and then looking into mimicking the the behaviour with a Javascript fetch request (but it is not ...
0
votes
0
answers
132
views
HTTP polling vs WebSocket for very small payloads that don't change often
In our team we are currently discussing which technology makes more sense for an upcoming feature - HTTP polling vs WebSocket.
To give some context:
We are developing a TV streaming application (...
5
votes
2
answers
16k
views
How do you set cookies on frontend from the backend?
I'm a little confused about how to handle cookies between frontend and backend.
I have a
frontend react application
a backend node express application.
The frontend is hosted on Netlify and the ...
0
votes
2
answers
47
views
Should an Express error handler be used to send HTTP 4xx responses?
In other words, should the raising of an HTTP 4xx code be considered an error, and should the job of sending an HTTP 4xx code to a client be delegated to an error handler?
Or is it simpler to just ...
0
votes
0
answers
216
views
In a microservices architecture, should each microservice handle its HTTP headers or should a proxy handle them?
In a case where having microservices deployed as containers without any orchestration tool, they need to define some HTTP response headers.
A way to achieve it is by having each microservice define ...
0
votes
2
answers
477
views
How to implement authorization in a microservices architecture?
I'm looking for a way to avoid centralized management of authorization rules. I'd like every microservice to be responsible for the authorization logic of its actions, but I'm having some trouble ...