openresty / openresty/lua-nginx-module

ngx.redirect 308 not supported

Open
#962 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

I am trying to redirect a POST request to some other link (not my own server) with all post values. 301 status code is not working because it changes the request type from POST to GET.

After some research I decided to try 308 instead but lua-nginx-module is throwing an error for that

lua entry thread aborted: runtime error: only ngx.HTTP_MOVED_TEMPORARILY, ngx.HTT
P_MOVED_PERMANENTLY, and ngx.HTTP_TEMPORARY_REDIRECT are allowed

relevant code

return ngx.redirect(my_link, 308)

this is within rewrite_by_lua_block

Contributor guide

No contributing guide indexed for this repository

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 at the ngx.redirect(my_link, 308) call in the rewrite_by_lua_block and trace the validation that rejects 308. Check the module's existing redirect handling and related tests, if present. Done means a 308 redirect is accepted without the runtime error and preserves the POST request semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.