dpn4073 2015-04-28 09:51
浏览 565

用于内部重定向的http_referer的最佳替代方案?

after discovering the unreliability of HTTP_REFERER, I was wondering what was the best alternative to indicate an operation the correct url of origin which then perform an internal redirect. After reading various topics I seemed to understand that only possible solutions are:

1) specify the referer url directly as a parameter of the operation.

2) create a custom referer storage system using session.

In my opinion, the first solution is logically more correct and free of contraindications. Using the second solution and storing the referrer in session on every page request is possible that using the site in the various tabs referrer stored does not correspond to the page where we're actually sending the operation; Despite this bug (in my opinion quite ugly) this second solution seemed the most recommended by experts. Why? Did I miss something? Thank you all for your attention and sorry for my low level of English.

  • 写回答

1条回答 默认 最新

  • dongying6659 2015-04-28 11:12
    关注

    storing the referrer in session on every page request is possible that using the site in the various tabs referrer stored does not correspond to the page where we're actually sending the operation; Despite this bug (in my opinion quite ugly) this second solution seemed the most recommended by experts

    You could notify server to update session with current page before leaving - this way next loaded page will know what was the previous one without passing anything in URL.

    That said though this solution still have some faults - it will break on any connection failure or if someone loads multiple pages in multiple tabs and requests go out of synch (it's relying on an assumption that between javascript sending request on leaving the page and server receiving request to load a next page nothing else occurs).

    Best way would be to use both - this and HTTP_REFERER as a fall-back option.

    Other than that mentioned passing of current pages in URL will do, but it's understandable why you try to avoid it.

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序