liveBook · Manning

Origin

As explained in Spring Security in Action, Second Edition

An origin is the scheme, host, and port tuple that identifies the security context of a web resource.

An origin is the scheme, host, and port tuple that identifies a web resource’s security context. Browsers use it when deciding whether a cross-origin response may be accepted. section 10.1

A request from http://localhost:8080 to http://127.0.0.1:8080 is cross-origin because the hosts differ. Without an accepted origin in Access-Control-Allow-Origin, the browser rejects the response, even if the server processes the request. section 10.1

A cross-origin request

A page loaded from http://localhost:8080 sends XMLHttpRequest to http://127.0.0.1:8080/test. The server logs the call, but the browser refuses the response because no Access-Control-Allow-Origin header permits the requesting origin.

How Spring Security in Action, Second Edition covers it

How deep it goes
Explains origin-based browser enforcement and simple versus preflighted requests, but does not detail origin parsing internals.
Examples
Uses localhost versus 127.0.0.1, XMLHttpRequest, Access-Control-Allow-Origin, and a Spring controller endpoint.
What it assumes
Assumes basic web requests and domains while introducing browser same-origin enforcement through a small Spring application.
What you can do after
Evaluate why a browser blocks a response and identify which origin a CORS policy must permit.
How it connects
Connects origins with CORS, HTTP headers, browsers, iframes, and cross-origin requests.

Also explained in

Compare how 3 books explain origin →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Security in Action, Second Edition. The section links point to the parts of the book it draws on.