Rails5.2.4.3 Ruby 2.6.3 I am building an application in the environment.
DB registration is successful on the controller and I am trying to redirect.
However, it cannot be redirected because the following redirect URL changes.
I would like to borrow the wisdom of those who have been able to meet and resolve similar events.

I'm running with the redirect_to method specifying the url,
The following is output on the log and cannot be redirected.

Redirected to http: // localhost: 3000/XXXX/YY
Completed 406 Not Acceptable in 200ms (ActiveRecord: 119.1ms)
ActionController :: UnknownFormat (ActionController :: UnknownFormat):
It will be.

Corresponding source code

url ='/ XXXX /'+ YY
redirect_to url

What I tried

Looking at the Fidder tool, the url of the request is
It's your own controller path, not/XXXX/YY
Furthermore, the Content-Type was text/plain instead of text/html.
I think this is probably the cause of UnknownFormat.

Supplementary information (FW/tool version, etc.)
  • Answer # 1

    This case has been resolved. I was just looking at the controller redirect_to,
    The cause was that the form tag was specified so that the screen was updated asynchronously.
    I understood by looking at the following article.

    <% = form_with model: @XXXX_XXXX do | f |%>

    However, I added local: true as shown below.

    <% = form_with model: @XXXX_XXXX, local: true do | f |%>

    We would like to thank winterboum for his cooperation, and we received a polite answer until the end on a precious Sunday.
    Thank you. Thank you very much.

  • Answer # 2

    Is the result of url ='/ XXXX /'+ YY'/ XXXX/YY'?
    Then trying to redirect to http: // localhost: 3000/XXXX/YY is the right thing to do.
    Where do you really want to go?