nginx / nginx/njs

Syntax for Submitting Subrequests to FastCGI

Open
#476 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

answered njs question
Dominant language
C
Stars
1.6k
Forks
239
Avg merge
2d 9h
Merged PRs (30d)
10

Description

Is there a syntax to submit subrequests to the FastCGI backend?

For example, if you want to use js_content to do some work before the content is retrieved, issue a subrequest to a FastCGI backend, and then do some work on the response (that can't be done by FastCGI and what it hands off to), then a subrequest to FastCGI would be needed to do that.

Right now, the documentation seems to imply that subrequests only work for proxy style locations. But is there a way to route the subrequest to a FastCGI backed?

I've tried using a subrequest to a named location, but that doesn't seem to work (it only works for internal redirection). Is there something that is supported like the below as a URI?

fastcgi://path/to/socket
fastcgi://ip:port

We use socket mode if that is relevant. But ultimately, I'm just looking for a way to issue a subrequest to a FastCGI backend.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the njs entry points for js_content and subrequests, then compare how named locations and FastCGI-backed locations are handled. Determine whether a supported way to issue a subrequest to a FastCGI backend exists; done means the syntax or limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nginx
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.